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

Saving an AdditionalFiles document in Balanced mode fails to trigger source generator #74395

Closed
AArnott opened this issue Jul 15, 2024 · 1 comment · Fixed by #74542
Closed
Assignees
Labels

Comments

@AArnott
Copy link
Contributor

AArnott commented Jul 15, 2024

Version Used: VS 17.12 (35114.17.main)

Steps to Reproduce:

  1. Configure C# Advanced to (its default) "Balanced" source generator mode.
  2. Create a new C# console project
  3. Add a package reference to Microsoft.Windows.CsWin32
  4. Create a NativeMethods.txt file and give it the content: GetTickCount
  5. Open Program.cs and write code to consume it.
  6. Reactivate the NativeMethods.txt file and clear the content.
  7. Save the file.

Expected Behavior:

Saving the NativeMethods.txt file, per the wording of the Balanced source generator mode, should trigger source generation, causing an error in Program.cs.

Actual Behavior:

Saving the NativeMethods.txt does not trigger source generation. Switching to Program.cs and saving it (though it has no unsaved changes) is necessary for the source generator to run again.

Proposal

Saving files in the AdditionalFile item list should trigger source generation the same way that saving Compile items does.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Jul 15, 2024
@CyrusNajmabadi
Copy link
Member

Yes. Def a bug.

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

Successfully merging a pull request may close this issue.

3 participants