Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compilation.EmitDifference produces no updated methods when "#line hidden" is present #49631

Closed
SteveSandersonMS opened this issue Nov 26, 2020 · 3 comments · Fixed by #53735
Closed
Assignees
Milestone

Comments

@SteveSandersonMS
Copy link
Member

Version Used: 3.8.0-5.final

Steps to Reproduce:

  1. Call compilation.EmitDifference, passing a single SemanticEdit that corresponds to a C# line that is preceded by #line hidden
  2. Observe that the updatedMethods collection is not populated with anything, whereas it would be if #line hidden was not present

Expected Behavior:

I definitely did not expect #line hidden to influence this. It took a long time to track down that this was causing the failure to produce deltas :)

Scenario:

I'm prototyping .NET 6 hot reload for Blazor. The Razor compiler prefixes pretty much all generated user code with #line hidden, so this behavior prevents changes in .razor files from being applied to the running app.

To show this is definitely what's interfering, I tried amending my hot reload prototype to contain newSourceText = newSourceText.Replace("#line hidden", "//#line hidden"); when reading the generated Razor source code, and it does make the problem go away, so user changes in .razor files do flow into the running app.

Related issue:

I expect this is related to #40655 and probably ties in with some historical quirks.

Request:

Is there some option to disable this special-casing of #line hidden? It's not something we'd want when it comes to processing the Razor compiler's generated code. If there's no option for that yet, would you consider adding one?

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Nov 26, 2020
@jaredpar
Copy link
Member

jaredpar commented Dec 7, 2020

ENC level issue moving to IDE

@jinujoseph jinujoseph added Area-Interactive Bug and removed Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Dec 9, 2020
@jinujoseph jinujoseph added this to the Backlog milestone Dec 9, 2020
@jinujoseph
Copy link
Contributor

cc @tmat

@tmat
Copy link
Member

tmat commented Apr 10, 2021

EnC now works in Razor files (with #52537), but function remapping is still broken due to #line mapping issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants