You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Report Requires diagnostics from dataflow analyzer (#92724)
This moves the logic for generating diagnostics about
RequiresUnreferencedCode, RequiresAssemblyFiles, and
RequiresDynamicCode attributes from the separate Requires* analyzers
into the DynamicallyAccessedMembersAnalyzer.
This includes logic for warning on access to attributed members, not
the warnings about mismatching attributes on base/override
methods. The override validation logic is still handled by the
respective analyzers.
The DynamicallyAccessedMembersAnalyzer is now turned on by any of the
settings EnableTrimAnalyzer, EnableAotAnalyzer, or
EnableSingleFileAnalyzer.
A new type DataFlowAnalyzerContext is used to cache per-compilation
state of the analyzers, to avoid recomputing it for each trim analysis
pattern that might potentially produce a warning. The context only
stores state for enabled analyzers, based on the MSBuild property
values.
There are a few minor differences in the warning behavior with this
change:
- Implicit calls to annotated base ctors warn because they are visible
in the CFG
- Unused local functions aren't discovered by the analysis, so don't
warn (matching linker/AOT behavior)
Also fixes a few asserts that were being hit with the live analyzer
(changes from de011df):
- Ref property passed as out parameter
- Delegate creation of an invocation operation
* Add test for annotated value assigned to event
* Use DiagnosticContext for consistency
* Move field access handling into dataflow analyzer
* Remove unnecessary merge logic for reflection access pattern
* PR feedback
- Clean up a few unused usings
- Remove unused Instance field
* Fix ExpectedWarnings for ILLink
* Fix assert for ref property as out param
And related cases involving implicit indexer references.
* Add test for deconstruction assignment to ref property
* Fix delegate creation over invocation
* Fix ExpectedWarnings for illink
* Silence dataflow warnings if EnableTrimAnalyer isn't set
Extra warnings were being produced on some projects where
the single-file analyzer was enabled, causing the DAM analyzer
to light up. The dataflow warnings were missing a check of
EnableTrimAnalzer to prevent these warnings.
This also lifts the checking of MSBuild property values out into
the compilation start action, so it only needs to be done per
compilation. The context type has been renamed to reflect that
it holds state relevant to all of the analyses handled by the
dataflow logic now.
* Add test coverage for EnableTrimAnalyzer checks
And add missing checks in DAM analyzer
0 commit comments