Source Generator instance lifetime in IDE #50586
-
I have a small question about Source Generator instance lifetime when it used by Visual Studio. Does Visual Studio creat Source Generator just once and later just reuse it? or instance created each time generator should run? I just curious if I could cache some data in instance field and use it on next generation. Or it's better to use other caching strategy? thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
From the
The compiler makes no guarantee one way or another. It would be inadvisable to rely on the current behavior regardless of what it is. |
Beta Was this translation helpful? Give feedback.
From the
ISourceGenerator
documentation:The compiler makes no guarantee one way or another. It would be inadvisable to rely on the current behavior regardless of what it is.