Visual Studio does not reload source generator assemblies when they change on disk
See original GitHub issueI’m just started writing a source generator, and I’m finding that Visual Studio is caching source generators aggressively, and it’s making it very hard to do iterative development.
This is what I’m having to do to make even small changes.
- Close Visual Studio (devenv.exe) instance in which the source generator project and its consumer (i.e., the project that
ProjectReference
’s the source generator) pskill /t servicehub.roslyncodeanalysisservice
del $env:TEMP\VS\AnalyzerAssemblyLoader -Recurse -Force
<- This is where the source generator binaries seem to get cached. Bothdevenv
andservicehub.roslyncodeanalysisservice
seems to hold handles to files under this location
Am I missing something simple to get the development process working more seamlessly ?
I’m on 5.0.100-rc.2.20473.20
+ Visual Studio 2019 Enterprise 16.8.0 Preview 4.0 [30517.14.main
Issue Analytics
- State:
- Created 3 years ago
- Reactions:42
- Comments:122 (64 by maintainers)
Top Results From Across the Web
c# - Source generator with physical files on disk causing ...
I 'm facing two issues now with my project, first is whenever I try to deserialize the json file (additional file) to my...
Read more >Microsoft.Extensions.Logging.Generators.dll: Could not ...
Please try to right-click your project node(in VS Solution Explorer) > Unload Project > right-click it again > Reload Project. And then click ......
Read more >Source Generators
A Source Generator is a .NET Standard 2.0 assembly that is loaded by the compiler along with any analyzers. It's usable in environments ......
Read more >C# Source Generators in Action, by Andrey Dyatlov - YouTube
C# 9 introduced the long-awaited compiler integrated code generation capability. If you 've dreamed of getting rid of thousands of lines of ...
Read more >Ngen.exe (Native Image Generator) - .NET Framework
The Native Image Generator (Ngen.exe) is a tool that improves the performance of managed applications. Ngen.exe creates native images, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@palpha I completely forgot that i had already released this extension which makes writing source generators with vs and not needing to restart VS all the time a blast: https://marketplace.visualstudio.com/items?itemName=AlexanderGayko.AutoUpdateAssemblyName
well, the problem usually can be solved nicely. but writing the correct source generator in the first place is a pain. i honestly wonder how the good people at MS doing that can stand all the waiting all the time. (or you have magic instantly-loading VS versions? if so, can we please have them, too? 😃