Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CsWinRT should enable AOT and single-file analyzers #1324

Closed
Sergio0694 opened this issue Apr 19, 2023 · 0 comments · Fixed by #1463
Closed

CsWinRT should enable AOT and single-file analyzers #1324

Sergio0694 opened this issue Apr 19, 2023 · 0 comments · Fixed by #1463
Labels
AOT enhancement New feature or request
Milestone

Comments

@Sergio0694
Copy link
Member

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AOT enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants