WinUI-Gallery icon indicating copy to clipboard operation
WinUI-Gallery copied to clipboard

Which warnings should be enforced as errors for AOT?

Open ghost1372 opened this issue 5 months ago • 1 comments

I'd like to start a discussion around which trimming and AOT-related warnings we should enforce as build errors by default.

When targeting Native AOT or enabling trimming, there are several warning categories—particularly ILxxxx, WMCxxxx, and CsWinRTxxxx—that indicate potential runtime issues (e.g. unsafe reflection, dynamic access, unsupported marshalling, or trimming-incompatible patterns).

⚠️ Candidate Warnings

The following warnings should be enforced as errors: WMC1500, WMC1510, CsWinRT1028.

However, I'm uncertain about the ILXXXX warnings, as there are too many of them (~40), and it's unclear whether we should include all of them.

IL2000;IL2001;IL2002;IL2003;...;IL2123; IL3000;...;IL3057;

FYI @marcelwgn

ghost1372 avatar Jul 30 '25 14:07 ghost1372

I'd like to start a discussion around which trimming and AOT-related warnings we should enforce as build errors by default.

When targeting Native AOT or enabling trimming, there are several warning categories—particularly ILxxxx, WMCxxxx, and CsWinRTxxxx—that indicate potential runtime issues (e.g. unsafe reflection, dynamic access, unsupported marshalling, or trimming-incompatible patterns).

⚠️ Candidate Warnings

The following warnings should be enforced as errors: WMC1500, WMC1510, CsWinRT1028.

However, I'm uncertain about the ILXXXX warnings, as there are too many of them (~40), and it's unclear whether we should include all of them.

IL2000;IL2001;IL2002;IL2003;...;IL2123; IL3000;...;IL3057;

FYI @marcelwgn

CSWINRT1028 may be related to set expressions. The official version of CSWINRT is not compatible with set expressions. You may need to use traditional methods where set expressions are used, for example

List<T> testList = []; // Collection expression
List<T> testList = new List<T>(); // Alternative statements

WMC1510 might be related to this https://github.com/microsoft/WinUI-Gallery/issues/1992

Gaoyifei1011 avatar Oct 18 '25 10:10 Gaoyifei1011