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

Remove unneeded file writes in Razor source generator #15958

Merged
merged 1 commit into from
Feb 19, 2021

Conversation

captainsafia
Copy link
Member

@captainsafia captainsafia added the Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, dotnet-watch label Feb 18, 2021
@captainsafia captainsafia requested review from pranavkm and a team February 18, 2021 23:34
@@ -36,16 +36,6 @@ internal class RazorSourceGenerationContext
/// </summary>
public bool WaitForDebugger { get; private set; }

/// <summary>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can keep this if it helps debugging. It's not enabled in the IDE which is primarily what they were concerned about. If you'd like we can rename this to have a TestOnly prefix

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late commentary, but I think we should reconsider this.

I think it's important to have the option to generate the source code, specially when it's disabled by default. Otherwise the current experience degrades a lot:

  • There are important integration aspects that we are not able to test.
  • Ourselves and customers look up at the generated code in many cases when we can't troubleshoot an issue.

What's the motivation behind completely removing it, I think a much better place is to leave it optional as it was up to now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@javiercn We'll be bringing this back -- but using the official compiler support for this feature instead of rolling our own file writes. We're tracking this in dotnet/aspnetcore#30302.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks. Although it's not exactly the same since I believe that triggers generation for all the source generators, not just the blazor one.

@@ -159,27 +152,13 @@ private static IReadOnlyList<TagHelperDescriptor> ResolveTagHelperDescriptors(Ge
Parallel.For(0, files.Count, GetParallelOptions(GeneratorExecutionContext), i =>
{
var file = files[i];
if (File.GetLastWriteTimeUtc(file.GeneratedDeclarationPath) > File.GetLastWriteTimeUtc(file.AdditionalText.Path))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can go away

@captainsafia captainsafia merged commit 7c6cd51 into master Feb 19, 2021
@akoeplinger akoeplinger deleted the safia/rsg-fs-c branch April 12, 2021 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, dotnet-watch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants