Skip to content

CsWinRT should enable AOT and single-file analyzers #1324

@Sergio0694

Description

@Sergio0694

Proposal: CsWinRT should enable AOT and single-file analyzers

Summary

While CsWinRT currently doesn't support AOT yet (I mean it kinda works in some scenarios if you try really hard, but it's not officially supported nor really usable in general), one issue it has is also that it doesn't come with AOT and single-file analyzers at all. This makes it even more difficult to try to make things work, as it's not really easy to understand which paths might potentially cause issues.

Both analyzers should be enabled, and the relative annotations should be added when needed, so that warnings will correctly propagated to callsites. Note: this doesn't mean CsWinRT has to be AOT-compatible from the get go: enabling analyzers is orthogonal in this sense and it will at least provide users with a better developer experience. It should then also make it easier to migrate things, as it'll clearly highlight code paths that can potentially break down and when.

In general, CsWinRT should enable these two MSBuild flags and add all necessary annotations:

<EnableAotAnalyzer>true</EnableAotAnalyzer>
<EnableSingleFileAnalyzer>true</EnableSingleFileAnalyzer>

These are on top of the (already enabled) trim analyzer.
The various attributes that will be needed are:

Rationale

  • Gradual step towards making CsWinRT AOT compatible
  • It will improve the developer experience using CsWinRT in AOT/single-file scenarios

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions