fix: Forward build options to code analyzers and generators #2891
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.
Stryker can now ignore some error reported by code generators. It may still fail when code generators are actually needed, but project not using those will no longer be affected.
Fix #2881.
May also fix #2736, #2776, #2797 and #1486
Note: a proper fix requires to find an instance of AnalyzerConfigOptionsProvider or implement one, which seems non trivial in the general sense. But a basic implementation returning values fromIAnalyzerResult
properties may be sufficient for some or most use cases.It turns out that implementing the basic version of an
AnalyzerConfigOptionsProvider
was straightforward and it fixes this issue. It should also help with sourcegenerator in general.Note that they are additional features to the
AnalyzerConfigOptionsProvider
that are harder to implement, such as supporting per source files options. But it looks that the C# compiler does not use these which could be dedicated to IDE.