Closed eerhardt closed 2 years ago
Also encountering this in some of my personal projects: https://github.com/terrafx/terrafx.interop.windows/runs/5545589775?check_suite_focus=true
Thanks for filing the issue! It looks like the root of these issues is the Roslyn API for symbols doesn't use nullable annotations, but the linker assumes that fields without the ?
will not be null. Usually this isn't a problem, but when we deal with COM interop, there are a lot of types without e.g. a namespace, and we run into issues there.
In particular, the MAUI issue seemed to be caused by an array type being used with COM interop. There is a fix here that should address the issue.
I'm getting the following error when setting
IsTrimmable=true
for the Maui Essentials project and building withmsbuild Essentials.csproj -p:Configuration=Release -t:Rebuild /bl
:This looks like https://github.com/dotnet/linker/issues/2622, but I believe it is a different issue because this method isn't using a pointer, and because the version of the ILLink.RoslynAnalyzer assembly I'm using is from https://github.com/dotnet/linker/commits/e9cfb5413a6a7a7b5bfc3b9a73671be2b18642cf, which has the fix for #2622.
To Repro
C:\git\maui\src\Essentials\src>msbuild Essentials.csproj -p:Configuration=Release -t:Rebuild /bl
cc @tlakollo