I patched the Microsoft.WinUI.AppX.targets to skip trimming check, and publish a blank unpackaged WinUI 3 app (WASDK 1.1-preview2) with NativeAOT, but got below exception during compilation:
One or more errors occurred. (Code generation failed for method '[Microsoft.Windows.SDK.NET]<GuidPatcherImplementationDetails>+<SignatureCache>ABI.Windows.Foundation.AsyncOperationWithProgressCompletedHandler`2<TResult,TProgress><System.__Canon,int32>..cctor()')
System.AggregateException: One or more errors occurred. (Code generation failed for method '[Microsoft.Windows.SDK.NET]<GuidPatcherImplementationDetails>+<SignatureCache>ABI.Windows.Foundation.AsyncOperationWithProgressCompletedHandler`2<TResult,TProgress><System.__Canon,int32>..cctor()')
---> ILCompiler.CodeGenerationFailedException: Code generation failed for method '[Microsoft.Windows.SDK.NET]<GuidPatcherImplementationDetails>+<SignatureCache>ABI.Windows.Foundation.AsyncOperationWithProgressCompletedHandler`2<TResult,TProgress><System.__Canon,int32>..cctor()'
---> System.InvalidOperationException: [Microsoft.Windows.SDK.NET]<GuidPatcherImplementationDetails>+<SignatureCache>ABI.Windows.Foundation.AsyncOperationWithProgressCompletedHandler`2<TResult,TProgress><System.__Canon,int32>: TypeHandle: [Microsoft.Windows.SDK.NET]<GuidPatcherImplementationDetails>+<SignatureCache>ABI.Windows.Foundation.AsyncOperationWithProgressCompletedHandler`2<TResult,TProgress><!0_System.__Canon,int32>
at ILCompiler.DependencyAnalysis.PrecomputedDictionaryLayoutNode.GetSlotForEntry(GenericLookupResult entry)
at ILCompiler.Compilation.ComputeGenericLookup(MethodDesc contextMethod, ReadyToRunHelperId lookupKind, Object targetOfLookup)
at Internal.JitInterface.CorInfoImpl.ComputeLookup(CORINFO_RESOLVED_TOKEN& pResolvedToken, Object entity, ReadyToRunHelperId helperId, CORINFO_LOOKUP& lookup)
at Internal.JitInterface.CorInfoImpl.embedGenericHandle(CORINFO_RESOLVED_TOKEN& pResolvedToken, Boolean fEmbedParent, CORINFO_GENERICHANDLE_RESULT& pResult)
at Internal.JitInterface.CorInfoImpl._embedGenericHandle(IntPtr thisHandle, IntPtr* ppException, CORINFO_RESOLVED_TOKEN* pResolvedToken, Byte fEmbedParent, CORINFO_GENERICHANDLE_RESULT* pResult)
--- End of inner exception stack trace ---
at Internal.JitInterface.CorInfoImpl.CompileMethodInternal(IMethodNode methodCodeNodeNeedingCode, MethodIL methodIL)
at Internal.JitInterface.CorInfoImpl.CompileMethod(MethodCodeNode methodCodeNodeNeedingCode, MethodIL methodIL)
at ILCompiler.RyuJitCompilation.CompileSingleMethod(CorInfoImpl corInfo, MethodCodeNode methodCodeNodeNeedingCode)
at System.Threading.Tasks.Parallel.<>c__DisplayClass33_0`2.<ForEachWorker>b__0(Int32 i)
at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`1.<ForWorker>b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
--- End of stack trace from previous location ---
at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`1.<ForWorker>b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
at System.Threading.Tasks.TaskReplicator.Replica.Execute()
--- End of inner exception stack trace ---
at System.Threading.Tasks.TaskReplicator.Run[TState](ReplicatableUserAction`1 action, ParallelOptions options, Boolean stopOnFirstFailure)
at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
--- End of stack trace from previous location ---
at System.Threading.Tasks.Parallel.ThrowSingleCancellationExceptionOrOtherException(ICollection exceptions, CancellationToken cancelToken, Exception otherException)
at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IList`1 list, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
at System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body)
at ILCompiler.RyuJitCompilation.CompileMultiThreaded(List`1 methodsToCompile)
at ILCompiler.RyuJitCompilation.ComputeDependencyNodeDependencies(List`1 obj)
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes()
at ILCompiler.RyuJitCompilation.CompileInternal(String outputFile, ObjectDumper dumper)
at ILCompiler.Compilation.ILCompiler.ICompilation.Compile(String outputFile, ObjectDumper dumper)
at ILCompiler.Program.Run(String[] args)
at ILCompiler.Program.Main(String[] args)
I patched the Microsoft.WinUI.AppX.targets to skip trimming check, and publish a blank unpackaged WinUI 3 app (WASDK 1.1-preview2) with NativeAOT, but got below exception during compilation: