roslyn
roslyn copied to clipboard
Source Generator - Visual representation of generated .g.cs files in Solution Explorer never updates
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:
Versions Used:
- Version 17.4.0 Preview 2.0
- Version 17.4.0 Preview 3.0 [32916.419.main]
Steps to Reproduce:
- Create a Source Generator
- Use the Source Generator and generate source code.
- Open the generated .g.cs file which are listed under your generator in Analyzers and Dependencies in the solution explorer.
- Modify either the Source Generator or the files which are used for basing the generated code files on.
- Clean and Recompile the solution.
- 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.
See https://github.com/dotnet/roslyn/issues/48083 🙂