[release/10.0-rc1] Add trim analysis for implicit constructors #118854
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.
Backport of #118755 to release/10.0-rc1
/cc @sbomer
Customer Impact
A customer used our tooling while working on MVVM Toolkit, and was surprised to see a new trim warning show up during publish for an implicit constructor. The warning was expected to be caught by the analyzer.
Code like the following doesn't produce analyzer trim warnings even though it is calling an annotated constructor. But when publishing the app there is a warning
B()'s call toA().Regression
Testing
This was a known analysis hole with existing analyzer test coverage. Updated the expected warning behavior for the analyzer tests.
Risk
Low. May introduce new build-time warnings for improperly annotated libraries, but the new warning is there for parity with publish-time warnings so this is mostly fixing a user experience problem (not a new class of warnings).