Difference between IIncrementalGenerator RegisterImplementationSourceOutput vs RegisterSourceOutput #66885
Replies: 4 comments 4 replies
-
The difference is intended as an IDE optimization, although we haven't actually fully done all the work for it so the end-to-end isn't quite working yet. Generated code generally can be thought of as going in one of two buckets:
The IDE needs to run generators from step 1 to have accurate IntelliSense. It doesn't (usually) need to run the second one -- that's needed during the actual compile, but the IDE doesn't care about it most of the time. So "implementation source output" would only be run by the command line compiler for an actual build, or in rarer cases for the IDE, wheras the first method runs everywhere. The idea is if your generator only needs to generate implementation code, we can skip all of that in the IDE for performance reasons. I'm hedging a bit about the IDE in that prior paragraph: we still would need to run the implementation source for edit and continue (since we're doing a "real" compile more or less in that case), and also if the user is trying to view generated code to set breakpoints, since you want to see the "real" code being ran in that case. As of this writing we're still actually running both in the IDE though, but we're looking at fixing that properly soon. |
Beta Was this translation helpful? Give feedback.
-
How about a code example? |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
what is the point of using it then??? |
Beta Was this translation helpful? Give feedback.
-
What is the difference between the two?
The explanation provided by the documentation seemed vague.
Can you provide an example use case in the documentation?
Beta Was this translation helpful? Give feedback.
All reactions