Mark source generator file as generated #16777
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Give the output file for the
ProvideApplicationPartFactoryAttribute
a.g
suffix so that it is treated as a generated file to prevent it being flagged by source analyzers for violations the application developer cannot fix themselves. See reactiveui/refit#1067 for a similar fix.Otherwise an application using a package such as StyleCop.Analyzers can receive warnings/errors for the code emitted by the source generator as it is not determined to have been generated by tooling and to be user code.
For example, using
6.0.100-preview.3.21202.5
of the SDK errors such as the following are emitted;I wasn't sure of the best way to add a unit test for this, or how to go about validating this locally.