roslyn icon indicating copy to clipboard operation
roslyn copied to clipboard

Source Generator - Visual representation of generated .g.cs files in Solution Explorer never updates

Open KlausLoeffelmann opened this issue 1 year ago • 1 comments

I am not entirely sure, if this is a bug or if there is an additional step involved, to mitigate this behavior. If it's not a bug, consider this to be feature request.

This is about the visual representation of the source code files, which are generated by a source generator:

image

Versions Used:

  • Version 17.4.0 Preview 2.0
  • Version 17.4.0 Preview 3.0 [32916.419.main]

Steps to Reproduce:

  1. Create a Source Generator
  2. Use the Source Generator and generate source code.
  3. Open the generated .g.cs file which are listed under your generator in Analyzers and Dependencies in the solution explorer.
  4. Modify either the Source Generator or the files which are used for basing the generated code files on.
  5. Clean and Recompile the solution.
  6. Look at the generated .g.cs files, and notice that they have not changed, although the underlaying code has been changed and was also taken into account.

Expected Behavior:

The generated .g.cs files should reflect the changes.

Actual Behavior:

The generated files are the version which was current when the solution compiled the first time. Then, they never get (visually) updated.

KlausLoeffelmann avatar Sep 20 '22 23:09 KlausLoeffelmann

See https://github.com/dotnet/roslyn/issues/48083 🙂

Eli-Black-Work avatar Sep 21 '22 08:09 Eli-Black-Work