Closed hez2010 closed 1 year ago
Could you please push the project to reproduce this into a scratch repo?
The repro need some modification to nuget packages and it also need VS to publish, so I cannot push a repro project that works out-of-box directly.
I will upload the rsp file and related DLLs later, so it can be reproduced via passing the rsp to ilc directly.
This is the repro: repro_rsp_with_deps.zip
The path of deps in rsp file may need some changes.
I've excluded dependencies in microsoft.netcore.app.runtime.win-x64 and runtime.win-x64.microsoft.dotnet.ilcompiler.
(I'm taking some time off so won't be looking at this but just FYI: we have <ItemGroup><IlcArg Include="--make-repro-path:some\path\to\file.zip" /></ItemGroup>
that will generate a ZIP with a response file and all other artifacts for you - no need to manually hunt for them.
I got suspicious about the <GuidPatcherImplementationDetails>
type and they're apparently doing some IL rewriting around there: https://github.com/microsoft/CsWinRT/tree/master/src/Perf/IIDOptimizer. Might not be an ILC bug. But not looking further.
@jkoritzinsky and @manodasanW Regarding the GUID patcher logic.
I decompiled the Microsoft.Windows.SDK.NET and searched for all <GuidPatcherImplementationDetails>+<SignatureCache>*
types.
Why there're a lot of types having 3 identical implememtation with the same name in the assembly?
and fields with same names:
Will this cause ilc to fail?
It looks like maybe the IID Optimizer tool doesn’t correctly check if it’s already ran on an assembly and something caused it to run on the same assembly multiple times.
I'm a bit surprised that JIT doesn't fail regarding so many duplicated types and fields in an assembly.
something caused it to run on the same assembly multiple times
I don't think this is the root cause, the IIDOptimizer already has the logic that prevent rerunning on the same assembly:
I've proposed a fix in https://github.com/microsoft/CsWinRT/pull/1174 /cc: @jkoritzinsky
I've proposed a fix in https://github.com/microsoft/CsWinRT/pull/1174
Did you have a chance to validate that this is fixing the NativeAOT crash?
Unfortunately, my fix doesn't fix the ilc crash. The original issue still present.
Error: 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)
Repro: 997755573_ComInteropApp.zip
Did some investigation, it failed to compile this method:
// [Microsoft.Windows.SDK.NET]<GuidPatcherImplementationDetails>+<SignatureCache>ABI.Windows.Foundation.AsyncOperationWithProgressCompletedHandler`2<TResult,TProgress><System.__Canon,int32>..cctor()
.method void .cctor() cil managed
{
// Code size: 616
.maxstack 4
.locals (int32 V_0,
valuetype [System.Private.CoreLib]System.ReadOnlySpan`1<uint8> V_1,
valuetype [System.Private.CoreLib]System.ReadOnlySpan`1<uint8> V_2,
valuetype [System.Private.CoreLib]System.ReadOnlySpan`1<uint8> V_3,
valuetype [System.Private.CoreLib]System.ReadOnlySpan`1<uint8> V_4,
valuetype [System.Private.CoreLib]System.ReadOnlySpan`1<uint8> V_5,
valuetype [System.Private.CoreLib]System.Span`1<uint8> V_6,
valuetype [System.Private.CoreLib]System.ReadOnlySpan`1<uint8> V_7,
int32 V_8,
valuetype [System.Private.CoreLib]System.Span`1<uint8> V_9,
valuetype [System.Private.CoreLib]System.Span`1<uint8> V_10)
IL_0000: ldc.i4 16
IL_0005: stloc 0
IL_0009: ldsflda valuetype <GuidPatcherImplementationDetails>/__StaticDataBlock<>Size=50 class <GuidPatcherImplementationDetails>/<SignatureCache>ABI.Windows.Foundation.AsyncOperationWithProgressCompletedHandler`2<TResult,TProgress><class [System.Private.CoreLib]System.__Canon, int32>::<SignatureDataPart=0>
IL_000E: ldc.i4 50
IL_0013: newobj instance void valuetype [System.Private.CoreLib]System.ReadOnlySpan`1<uint8>::.ctor(void*, int32)
IL_0018: stloc 1
IL_001C: ldloc 0
IL_0020: ldc.i4 50
IL_0025: add.ovf
IL_0026: stloc 0
IL_002A: call class [System.Private.CoreLib]System.Text.Encoding [System.Private.CoreLib]System.Text.Encoding::get_UTF8()
IL_002F: ldtoken [System.Private.CoreLib]System.__Canon
IL_0034: call class [System.Private.CoreLib]System.Type [System.Private.CoreLib]System.Type::GetTypeFromHandle(valuetype [System.Private.CoreLib]System.RuntimeTypeHandle)
IL_0039: call string [WinRT.Runtime]WinRT.GuidGenerator::GetSignature(class [System.Private.CoreLib]System.Type)
IL_003E: callvirt instance uint8[] [System.Private.CoreLib]System.Text.Encoding::GetBytes(string)
IL_0043: dup
IL_0044: newobj instance void valuetype [System.Private.CoreLib]System.ReadOnlySpan`1<uint8>::.ctor(uint8[])
IL_0049: stloc 2
IL_004D: ldlen
IL_004E: ldloc 0
IL_0052: add.ovf
IL_0053: stloc 0
IL_0057: ldsflda valuetype <GuidPatcherImplementationDetails>/__StaticDataBlock<>Size=1 class <GuidPatcherImplementationDetails>/<SignatureCache>ABI.Windows.Foundation.AsyncOperationWithProgressCompletedHandler`2<TResult,TProgress><class [System.Private.CoreLib]System.__Canon, int32>::<SignatureDataPart=2>
IL_005C: ldc.i4 1
IL_0061: newobj instance void valuetype [System.Private.CoreLib]System.ReadOnlySpan`1<uint8>::.ctor(void*, int32)
IL_0066: stloc 3
IL_006A: ldloc 0
IL_006E: ldc.i4 1
IL_0073: add.ovf
IL_0074: stloc 0
IL_0078: call class [System.Private.CoreLib]System.Text.Encoding [System.Private.CoreLib]System.Text.Encoding::get_UTF8()
IL_007D: ldtoken int32
IL_0082: call class [System.Private.CoreLib]System.Type [System.Private.CoreLib]System.Type::GetTypeFromHandle(valuetype [System.Private.CoreLib]System.RuntimeTypeHandle)
IL_0087: call string [WinRT.Runtime]WinRT.GuidGenerator::GetSignature(class [System.Private.CoreLib]System.Type)
IL_008C: callvirt instance uint8[] [System.Private.CoreLib]System.Text.Encoding::GetBytes(string)
IL_0091: dup
IL_0092: newobj instance void valuetype [System.Private.CoreLib]System.ReadOnlySpan`1<uint8>::.ctor(uint8[])
IL_0097: stloc 4
IL_009B: ldlen
IL_009C: ldloc 0
IL_00A0: add.ovf
IL_00A1: stloc 0
IL_00A5: ldsflda valuetype <GuidPatcherImplementationDetails>/__StaticDataBlock<>Size=1 class <GuidPatcherImplementationDetails>/<SignatureCache>ABI.Windows.Foundation.AsyncOperationWithProgressCompletedHandler`2<TResult,TProgress><class [System.Private.CoreLib]System.__Canon, int32>::<SignatureDataPart=4>
IL_00AA: ldc.i4 1
IL_00AF: newobj instance void valuetype [System.Private.CoreLib]System.ReadOnlySpan`1<uint8>::.ctor(void*, int32)
IL_00B4: stloc 5
IL_00B8: ldloc 0
IL_00BC: ldc.i4 1
IL_00C1: add.ovf
IL_00C2: stloc 0
IL_00C6: ldloc 0
IL_00CA: newarr uint8
IL_00CF: newobj instance void valuetype [System.Private.CoreLib]System.Span`1<uint8>::.ctor(uint8[])
IL_00D4: stloc 6
IL_00D8: ldsflda valuetype <GuidPatcherImplementationDetails>/__StaticDataBlock<>Size=16 <GuidPatcherImplementationDetails>::<WinRTPinterfaceNamespaceBytes>
IL_00DD: ldc.i4 16
IL_00E2: newobj instance void valuetype [System.Private.CoreLib]System.ReadOnlySpan`1<uint8>::.ctor(void*, int32)
IL_00E7: stloc 7
IL_00EB: ldloca 7
IL_00EF: ldloc 6
IL_00F3: call instance void valuetype [System.Private.CoreLib]System.ReadOnlySpan`1<uint8>::CopyTo(valuetype [System.Private.CoreLib]System.Span`1<uint8>)
IL_00F8: ldc.i4 16
IL_00FD: stloc 8
IL_0101: ldloca 1
IL_0105: dup
IL_0106: ldloca 6
IL_010A: ldloc 8
IL_010E: call instance valuetype [System.Private.CoreLib]System.Span`1<uint8> valuetype [System.Private.CoreLib]System.Span`1<uint8>::Slice(int32)
IL_0113: call instance void valuetype [System.Private.CoreLib]System.ReadOnlySpan`1<uint8>::CopyTo(valuetype [System.Private.CoreLib]System.Span`1<uint8>)
IL_0118: call instance int32 valuetype [System.Private.CoreLib]System.ReadOnlySpan`1<uint8>::get_Length()
IL_011D: ldloc 8
IL_0121: add
IL_0122: stloc 8
IL_0126: ldloca 2
IL_012A: dup
IL_012B: ldloca 6
IL_012F: ldloc 8
IL_0133: call instance valuetype [System.Private.CoreLib]System.Span`1<uint8> valuetype [System.Private.CoreLib]System.Span`1<uint8>::Slice(int32)
IL_0138: call instance void valuetype [System.Private.CoreLib]System.ReadOnlySpan`1<uint8>::CopyTo(valuetype [System.Private.CoreLib]System.Span`1<uint8>)
IL_013D: call instance int32 valuetype [System.Private.CoreLib]System.ReadOnlySpan`1<uint8>::get_Length()
IL_0142: ldloc 8
IL_0146: add
IL_0147: stloc 8
IL_014B: ldloca 3
IL_014F: dup
IL_0150: ldloca 6
IL_0154: ldloc 8
IL_0158: call instance valuetype [System.Private.CoreLib]System.Span`1<uint8> valuetype [System.Private.CoreLib]System.Span`1<uint8>::Slice(int32)
IL_015D: call instance void valuetype [System.Private.CoreLib]System.ReadOnlySpan`1<uint8>::CopyTo(valuetype [System.Private.CoreLib]System.Span`1<uint8>)
IL_0162: call instance int32 valuetype [System.Private.CoreLib]System.ReadOnlySpan`1<uint8>::get_Length()
IL_0167: ldloc 8
IL_016B: add
IL_016C: stloc 8
IL_0170: ldloca 4
IL_0174: dup
IL_0175: ldloca 6
IL_0179: ldloc 8
IL_017D: call instance valuetype [System.Private.CoreLib]System.Span`1<uint8> valuetype [System.Private.CoreLib]System.Span`1<uint8>::Slice(int32)
IL_0182: call instance void valuetype [System.Private.CoreLib]System.ReadOnlySpan`1<uint8>::CopyTo(valuetype [System.Private.CoreLib]System.Span`1<uint8>)
IL_0187: call instance int32 valuetype [System.Private.CoreLib]System.ReadOnlySpan`1<uint8>::get_Length()
IL_018C: ldloc 8
IL_0190: add
IL_0191: stloc 8
IL_0195: ldloca 5
IL_0199: dup
IL_019A: ldloca 6
IL_019E: ldloc 8
IL_01A2: call instance valuetype [System.Private.CoreLib]System.Span`1<uint8> valuetype [System.Private.CoreLib]System.Span`1<uint8>::Slice(int32)
IL_01A7: call instance void valuetype [System.Private.CoreLib]System.ReadOnlySpan`1<uint8>::CopyTo(valuetype [System.Private.CoreLib]System.Span`1<uint8>)
IL_01AC: call instance int32 valuetype [System.Private.CoreLib]System.ReadOnlySpan`1<uint8>::get_Length()
IL_01B1: ldloc 8
IL_01B5: add
IL_01B6: stloc 8
IL_01BA: ldc.i4 160
IL_01BF: localloc
IL_01C1: ldc.i4 160
IL_01C6: newobj instance void valuetype [System.Private.CoreLib]System.Span`1<uint8>::.ctor(void*, int32)
IL_01CB: stloc 9
IL_01CF: ldloc 6
IL_01D3: call valuetype [System.Private.CoreLib]System.ReadOnlySpan`1<uint8> valuetype [System.Private.CoreLib]System.Span`1<uint8>::op_Implicit(valuetype [System.Private.CoreLib]System.Span`1<uint8>)
IL_01D8: ldloc 9
IL_01DC: call int32 [System.Security.Cryptography]System.Security.Cryptography.SHA1::HashData(valuetype [System.Private.CoreLib]System.ReadOnlySpan`1<uint8>, valuetype [System.Private.CoreLib]System.Span`1<uint8>)
IL_01E1: pop
IL_01E2: ldloca 9
IL_01E6: ldc.i4.0
IL_01E7: ldc.i4.4
IL_01E8: call instance valuetype [System.Private.CoreLib]System.Span`1<uint8> valuetype [System.Private.CoreLib]System.Span`1<uint8>::Slice(int32, int32)
IL_01ED: call void [System.Private.CoreLib]System.MemoryExtensions::Reverse<uint8>(valuetype [System.Private.CoreLib]System.Span`1<!!0>)
IL_01F2: ldloca 9
IL_01F6: ldc.i4.4
IL_01F7: ldc.i4.2
IL_01F8: call instance valuetype [System.Private.CoreLib]System.Span`1<uint8> valuetype [System.Private.CoreLib]System.Span`1<uint8>::Slice(int32, int32)
IL_01FD: call void [System.Private.CoreLib]System.MemoryExtensions::Reverse<uint8>(valuetype [System.Private.CoreLib]System.Span`1<!!0>)
IL_0202: ldloca 9
IL_0206: ldc.i4.6
IL_0207: ldc.i4.2
IL_0208: call instance valuetype [System.Private.CoreLib]System.Span`1<uint8> valuetype [System.Private.CoreLib]System.Span`1<uint8>::Slice(int32, int32)
IL_020D: call void [System.Private.CoreLib]System.MemoryExtensions::Reverse<uint8>(valuetype [System.Private.CoreLib]System.Span`1<!!0>)
IL_0212: ldloca 9
IL_0216: ldc.i4.7
IL_0217: call instance uint8& valuetype [System.Private.CoreLib]System.Span`1<uint8>::get_Item(int32)
IL_021C: dup
IL_021D: ldind.u1
IL_021E: ldc.i4 15
IL_0223: and
IL_0224: ldc.i4 80
IL_0229: or
IL_022A: conv.u1
IL_022B: stind.i1
IL_022C: ldloca 9
IL_0230: ldc.i4.8
IL_0231: call instance uint8& valuetype [System.Private.CoreLib]System.Span`1<uint8>::get_Item(int32)
IL_0236: dup
IL_0237: ldind.u1
IL_0238: ldc.i4 63
IL_023D: and
IL_023E: ldc.i4 128
IL_0243: or
IL_0244: conv.u1
IL_0245: stind.i1
IL_0246: ldloca 9
IL_024A: ldc.i4.0
IL_024B: ldc.i4 16
IL_0250: call instance valuetype [System.Private.CoreLib]System.Span`1<uint8> valuetype [System.Private.CoreLib]System.Span`1<uint8>::Slice(int32, int32)
IL_0255: stloc 10
IL_0259: ldloca 10
IL_025D: call instance uint8[] valuetype [System.Private.CoreLib]System.Span`1<uint8>::ToArray()
IL_0262: stsfld uint8[] class <GuidPatcherImplementationDetails>/<SignatureCache>ABI.Windows.Foundation.AsyncOperationWithProgressCompletedHandler`2<TResult,TProgress><class [System.Private.CoreLib]System.__Canon, int32>::iidData
IL_0267: ret
}
Failure occurred in Internal.JitInterface.CompileMethodInternal
.
ILDASM of that method is very weird:
.method private specialname rtspecialname static
void .cctor() cil managed
{
// Code size 616 (0x268)
.maxstack 4
.locals (int32 V_0,
valuetype [System.Runtime]System.ReadOnlySpan`1<uint8> V_1,
valuetype [System.Runtime]System.ReadOnlySpan`1<uint8> V_2,
valuetype [System.Runtime]System.ReadOnlySpan`1<uint8> V_3,
valuetype [System.Runtime]System.ReadOnlySpan`1<uint8> V_4,
valuetype [System.Runtime]System.ReadOnlySpan`1<uint8> V_5,
valuetype [System.Runtime]System.Span`1<uint8> V_6,
valuetype [System.Runtime]System.ReadOnlySpan`1<uint8> V_7,
int32 V_8,
valuetype [System.Runtime]System.Span`1<uint8> V_9,
valuetype [System.Runtime]System.Span`1<uint8> V_10)
IL_0000: ldc.i4 0x10
IL_0005: stloc V_0
IL_0009: ldsflda valuetype '<GuidPatcherImplementationDetails>'/'__StaticDataBlock<>Size=50' class '<GuidPatcherImplementationDetails>'/'<SignatureCache>ABI.Windows.Foundation.AsyncOperationWithProgressCompletedHandler`2<TResult,TProgress>'<!'!0',!'!1'>::'<SignatureDataPart=0>'
IL_000e: ldc.i4 0x32
IL_0013: newobj instance void valuetype [System.Runtime]System.ReadOnlySpan`1<uint8>::.ctor(void*,
int32)
IL_0018: stloc V_1
IL_001c: ldloc V_0
IL_0020: ldc.i4 0x32
IL_0025: add.ovf
IL_0026: stloc V_0
IL_002a: call class [System.Runtime]System.Text.Encoding [System.Runtime]System.Text.Encoding::get_UTF8()
IL_002f: ldtoken !'!0'
IL_0034: call class [System.Runtime]System.Type [System.Runtime]System.Type::GetTypeFromHandle(valuetype [System.Runtime]System.RuntimeTypeHandle)
IL_0039: call string [WinRT.Runtime]WinRT.GuidGenerator::GetSignature(class [System.Runtime]System.Type)
IL_003e: callvirt instance uint8[] [System.Runtime]System.Text.Encoding::GetBytes(string)
IL_0043: dup
IL_0044: newobj instance void valuetype [System.Runtime]System.ReadOnlySpan`1<uint8>::.ctor(!0[])
IL_0049: stloc V_2
IL_004d: ldlen
IL_004e: ldloc V_0
IL_0052: add.ovf
IL_0053: stloc V_0
IL_0057: ldsflda valuetype '<GuidPatcherImplementationDetails>'/'__StaticDataBlock<>Size=1' class '<GuidPatcherImplementationDetails>'/'<SignatureCache>ABI.Windows.Foundation.AsyncOperationWithProgressCompletedHandler`2<TResult,TProgress>'<!'!0',!'!1'>::'<SignatureDataPart=2>'
IL_005c: ldc.i4 0x1
IL_0061: newobj instance void valuetype [System.Runtime]System.ReadOnlySpan`1<uint8>::.ctor(void*,
int32)
IL_0066: stloc V_3
IL_006a: ldloc V_0
IL_006e: ldc.i4 0x1
IL_0073: add.ovf
IL_0074: stloc V_0
IL_0078: call class [System.Runtime]System.Text.Encoding [System.Runtime]System.Text.Encoding::get_UTF8()
IL_007d: ldtoken !'!1'
IL_0082: call class [System.Runtime]System.Type [System.Runtime]System.Type::GetTypeFromHandle(valuetype [System.Runtime]System.RuntimeTypeHandle)
IL_0087: call string [WinRT.Runtime]WinRT.GuidGenerator::GetSignature(class [System.Runtime]System.Type)
IL_008c: callvirt instance uint8[] [System.Runtime]System.Text.Encoding::GetBytes(string)
IL_0091: dup
IL_0092: newobj instance void valuetype [System.Runtime]System.ReadOnlySpan`1<uint8>::.ctor(!0[])
IL_0097: stloc V_4
IL_009b: ldlen
IL_009c: ldloc V_0
IL_00a0: add.ovf
IL_00a1: stloc V_0
IL_00a5: ldsflda valuetype '<GuidPatcherImplementationDetails>'/'__StaticDataBlock<>Size=1' class '<GuidPatcherImplementationDetails>'/'<SignatureCache>ABI.Windows.Foundation.AsyncOperationWithProgressCompletedHandler`2<TResult,TProgress>'<!'!0',!'!1'>::'<SignatureDataPart=4>'
IL_00aa: ldc.i4 0x1
IL_00af: newobj instance void valuetype [System.Runtime]System.ReadOnlySpan`1<uint8>::.ctor(void*,
int32)
IL_00b4: stloc V_5
IL_00b8: ldloc V_0
IL_00bc: ldc.i4 0x1
IL_00c1: add.ovf
IL_00c2: stloc V_0
IL_00c6: ldloc V_0
IL_00ca: newarr [System.Runtime]System.Byte
IL_00cf: newobj instance void valuetype [System.Runtime]System.Span`1<uint8>::.ctor(!0[])
IL_00d4: stloc V_6
IL_00d8: ldsflda valuetype '<GuidPatcherImplementationDetails>'/'__StaticDataBlock<>Size=16' '<GuidPatcherImplementationDetails>'::'<WinRTPinterfaceNamespaceBytes>'
IL_00dd: ldc.i4 0x10
IL_00e2: newobj instance void valuetype [System.Runtime]System.ReadOnlySpan`1<uint8>::.ctor(void*,
int32)
IL_00e7: stloc V_7
IL_00eb: ldloca V_7
IL_00ef: ldloc V_6
IL_00f3: call instance void valuetype [System.Runtime]System.ReadOnlySpan`1<uint8>::CopyTo(valuetype [System.Runtime]System.Span`1<!0>)
IL_00f8: ldc.i4 0x10
IL_00fd: stloc V_8
IL_0101: ldloca V_1
IL_0105: dup
IL_0106: ldloca V_6
IL_010a: ldloc V_8
IL_010e: call instance valuetype [System.Runtime]System.Span`1<!0> valuetype [System.Runtime]System.Span`1<uint8>::Slice(int32)
IL_0113: call instance void valuetype [System.Runtime]System.ReadOnlySpan`1<uint8>::CopyTo(valuetype [System.Runtime]System.Span`1<!0>)
IL_0118: call instance int32 valuetype [System.Runtime]System.ReadOnlySpan`1<uint8>::get_Length()
IL_011d: ldloc V_8
IL_0121: add
IL_0122: stloc V_8
IL_0126: ldloca V_2
IL_012a: dup
IL_012b: ldloca V_6
IL_012f: ldloc V_8
IL_0133: call instance valuetype [System.Runtime]System.Span`1<!0> valuetype [System.Runtime]System.Span`1<uint8>::Slice(int32)
IL_0138: call instance void valuetype [System.Runtime]System.ReadOnlySpan`1<uint8>::CopyTo(valuetype [System.Runtime]System.Span`1<!0>)
IL_013d: call instance int32 valuetype [System.Runtime]System.ReadOnlySpan`1<uint8>::get_Length()
IL_0142: ldloc V_8
IL_0146: add
IL_0147: stloc V_8
IL_014b: ldloca V_3
IL_014f: dup
IL_0150: ldloca V_6
IL_0154: ldloc V_8
IL_0158: call instance valuetype [System.Runtime]System.Span`1<!0> valuetype [System.Runtime]System.Span`1<uint8>::Slice(int32)
IL_015d: call instance void valuetype [System.Runtime]System.ReadOnlySpan`1<uint8>::CopyTo(valuetype [System.Runtime]System.Span`1<!0>)
IL_0162: call instance int32 valuetype [System.Runtime]System.ReadOnlySpan`1<uint8>::get_Length()
IL_0167: ldloc V_8
IL_016b: add
IL_016c: stloc V_8
IL_0170: ldloca V_4
IL_0174: dup
IL_0175: ldloca V_6
IL_0179: ldloc V_8
IL_017d: call instance valuetype [System.Runtime]System.Span`1<!0> valuetype [System.Runtime]System.Span`1<uint8>::Slice(int32)
IL_0182: call instance void valuetype [System.Runtime]System.ReadOnlySpan`1<uint8>::CopyTo(valuetype [System.Runtime]System.Span`1<!0>)
IL_0187: call instance int32 valuetype [System.Runtime]System.ReadOnlySpan`1<uint8>::get_Length()
IL_018c: ldloc V_8
IL_0190: add
IL_0191: stloc V_8
IL_0195: ldloca V_5
IL_0199: dup
IL_019a: ldloca V_6
IL_019e: ldloc V_8
IL_01a2: call instance valuetype [System.Runtime]System.Span`1<!0> valuetype [System.Runtime]System.Span`1<uint8>::Slice(int32)
IL_01a7: call instance void valuetype [System.Runtime]System.ReadOnlySpan`1<uint8>::CopyTo(valuetype [System.Runtime]System.Span`1<!0>)
IL_01ac: call instance int32 valuetype [System.Runtime]System.ReadOnlySpan`1<uint8>::get_Length()
IL_01b1: ldloc V_8
IL_01b5: add
IL_01b6: stloc V_8
IL_01ba: ldc.i4 0xa0
IL_01bf: localloc
IL_01c1: ldc.i4 0xa0
IL_01c6: newobj instance void valuetype [System.Runtime]System.Span`1<uint8>::.ctor(void*,
int32)
IL_01cb: stloc V_9
IL_01cf: ldloc V_6
IL_01d3: call valuetype [System.Runtime]System.ReadOnlySpan`1<!0> valuetype [System.Runtime]System.Span`1<uint8>::op_Implicit(valuetype [System.Runtime]System.Span`1<!0>)
IL_01d8: ldloc V_9
IL_01dc: call int32 [System.Security.Cryptography.Algorithms]System.Security.Cryptography.SHA1::HashData(valuetype [System.Runtime]System.ReadOnlySpan`1<uint8>,
valuetype [System.Runtime]System.Span`1<uint8>)
IL_01e1: pop
IL_01e2: ldloca V_9
IL_01e6: ldc.i4.0
IL_01e7: ldc.i4.4
IL_01e8: call instance valuetype [System.Runtime]System.Span`1<!0> valuetype [System.Runtime]System.Span`1<uint8>::Slice(int32,
int32)
IL_01ed: call void [System.Memory]System.MemoryExtensions::Reverse<uint8>(valuetype [System.Runtime]System.Span`1<!!0>)
IL_01f2: ldloca V_9
IL_01f6: ldc.i4.4
IL_01f7: ldc.i4.2
IL_01f8: call instance valuetype [System.Runtime]System.Span`1<!0> valuetype [System.Runtime]System.Span`1<uint8>::Slice(int32,
int32)
IL_01fd: call void [System.Memory]System.MemoryExtensions::Reverse<uint8>(valuetype [System.Runtime]System.Span`1<!!0>)
IL_0202: ldloca V_9
IL_0206: ldc.i4.6
IL_0207: ldc.i4.2
IL_0208: call instance valuetype [System.Runtime]System.Span`1<!0> valuetype [System.Runtime]System.Span`1<uint8>::Slice(int32,
int32)
IL_020d: call void [System.Memory]System.MemoryExtensions::Reverse<uint8>(valuetype [System.Runtime]System.Span`1<!!0>)
IL_0212: ldloca V_9
IL_0216: ldc.i4.7
IL_0217: call instance !0& valuetype [System.Runtime]System.Span`1<uint8>::get_Item(int32)
IL_021c: dup
IL_021d: ldind.u1
IL_021e: ldc.i4 0xf
IL_0223: and
IL_0224: ldc.i4 0x50
IL_0229: or
IL_022a: conv.u1
IL_022b: stind.i1
IL_022c: ldloca V_9
IL_0230: ldc.i4.8
IL_0231: call instance !0& valuetype [System.Runtime]System.Span`1<uint8>::get_Item(int32)
IL_0236: dup
IL_0237: ldind.u1
IL_0238: ldc.i4 0x3f
IL_023d: and
IL_023e: ldc.i4 0x80
IL_0243: or
IL_0244: conv.u1
IL_0245: stind.i1
IL_0246: ldloca V_9
IL_024a: ldc.i4.0
IL_024b: ldc.i4 0x10
IL_0250: call instance valuetype [System.Runtime]System.Span`1<!0> valuetype [System.Runtime]System.Span`1<uint8>::Slice(int32,
int32)
IL_0255: stloc V_10
IL_0259: ldloca V_10
IL_025d: call instance !0[] valuetype [System.Runtime]System.Span`1<uint8>::ToArray()
IL_0262: stsfld uint8[] class '<GuidPatcherImplementationDetails>'/'<SignatureCache>ABI.Windows.Foundation.AsyncOperationWithProgressCompletedHandler`2<TResult,TProgress>'<!'!0',!'!1'>::iidData
IL_0267: ret
} // end of method '<SignatureCache>ABI.Windows.Foundation.AsyncOperationWithProgressCompletedHandler`2<TResult,TProgress>'::.cctor
Notice the ldtoken !'!0'
and ldtoken !'!1'
. This should be just ldtoken !0
and ldtoken !1
(first generic argument of the containing class). I've never seen !'!0'
. Things are quite broken in that assembly.
Notice the
ldtoken !'!0'
andldtoken !'!1'
. This should be justldtoken !0
andldtoken !1
(first generic argument of the containing class). I've never seen!'!0'
. Things are quite broken in that assembly.
The containing class has a signature
.class nested private auto ansi abstract sealed '<SignatureCache>ABI.Windows.Foundation.AsyncOperationProgressHandler`2<TResult,TProgress>'<'!0', '!1'>
extends [System.Runtime]System.Object
Ah, I see. So the <TResult, TProgress>
part is part of the type name and the actual generic parameters are unnamed. That is a pretty confusing setup but okay I guess.
I tried to compile with un-IIDOptimizer-optimized assembly, but it still fail to compile:
<unknown>:0: error: invalid symbol redefinition
<unknown>:0: error: invalid symbol redefinition
I hit several asserts:
---- DEBUG ASSERTION FAILED ----
---- Assert Short Message ----
---- Assert Long Message ----
at Internal.TypeSystem.TypeSystemComparer.Compare(MethodDesc x, MethodDesc y) in D:\source\repos\dotnet\runtime\src\coreclr\tools\Common\TypeSystem\Sorting\TypeSystemComparer.cs:line 90
at ILCompiler.DependencyAnalysis.MethodCodeNode.CompareToImpl(ISortableNode other, CompilerComparer comparer) in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler.RyuJit\Compiler\DependencyAnalysis\MethodCodeNode.cs:line 300
at ILCompiler.DependencyAnalysis.CompilerComparer.Compare(ISortableNode x, ISortableNode y) in D:\source\repos\dotnet\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\CompilerComparer.cs:line 29
at System.Collections.Generic.SortedSet`1.AddIfNotPresent(T item)
at System.Collections.Generic.SortedSet`1.Add(T item)
at ILCompiler.MetadataManager.Graph_NewMarkedNode(DependencyNodeCore`1 obj) in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler.Compiler\Compiler\MetadataManager.cs:line 183
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.AddToMarkStack(DependencyNodeCore`1 node, String reason, DependencyNodeCore`1 reason1, DependencyNodeCore`1 reason2) in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler.DependencyAnalysisFramework\DependencyAnalyzer.cs:line 366
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependenciesImpl(DependencyNodeCore`1 node) in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler.DependencyAnalysisFramework\DependencyAnalyzer.cs:line 186
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler.DependencyAnalysisFramework\DependencyAnalyzer.cs:line 319
at ILCompiler.RyuJitCompilation.CompileInternal(String outputFile, ObjectDumper dumper) in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler.RyuJit\Compiler\RyuJitCompilation.cs:line 88
at ILCompiler.Compilation.ILCompiler.ICompilation.Compile(String outputFile, ObjectDumper dumper) in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler.Compiler\Compiler\Compilation.cs:line 526
at ILCompiler.Program.Run(String[] args) in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler\Program.cs:line 892
at ILCompiler.Program.Main(String[] args) in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler\Program.cs:line 1075
---- DEBUG ASSERTION FAILED ----
---- Assert Short Message ----
---- Assert Long Message ----
at ILCompiler.DependencyAnalysis.CompilerComparer.Compare(ISortableNode x, ISortableNode y) in D:\source\repos\dotnet\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\CompilerComparer.cs:line 32
at System.Collections.Generic.SortedSet`1.AddIfNotPresent(T item)
at System.Collections.Generic.SortedSet`1.Add(T item)
at ILCompiler.MetadataManager.Graph_NewMarkedNode(DependencyNodeCore`1 obj) in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler.Compiler\Compiler\MetadataManager.cs:line 183
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.AddToMarkStack(DependencyNodeCore`1 node, String reason, DependencyNodeCore`1 reason1, DependencyNodeCore`1 reason2) in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler.DependencyAnalysisFramework\DependencyAnalyzer.cs:line 366
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependenciesImpl(DependencyNodeCore`1 node) in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler.DependencyAnalysisFramework\DependencyAnalyzer.cs:line 186
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler.DependencyAnalysisFramework\DependencyAnalyzer.cs:line 319
at ILCompiler.RyuJitCompilation.CompileInternal(String outputFile, ObjectDumper dumper) in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler.RyuJit\Compiler\RyuJitCompilation.cs:line 88
at ILCompiler.Compilation.ILCompiler.ICompilation.Compile(String outputFile, ObjectDumper dumper) in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler.Compiler\Compiler\Compilation.cs:line 526
at ILCompiler.Program.Run(String[] args) in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler\Program.cs:line 892
at ILCompiler.Program.Main(String[] args) in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler\Program.cs:line 1075
---- DEBUG ASSERTION FAILED ----
---- Assert Short Message ----
---- Assert Long Message ----
at Internal.TypeSystem.TypeSystemComparer.Compare(MethodDesc x, MethodDesc y) in D:\source\repos\dotnet\runtime\src\coreclr\tools\Common\TypeSystem\Sorting\TypeSystemComparer.cs:line 90
at System.Collections.Generic.SortedSet`1.AddIfNotPresent(T item)
at System.Collections.Generic.SortedSet`1.Add(T item)
at ILCompiler.MetadataManager.Graph_NewMarkedNode(DependencyNodeCore`1 obj) in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler.Compiler\Compiler\MetadataManager.cs:line 198
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.AddToMarkStack(DependencyNodeCore`1 node, String reason, DependencyNodeCore`1 reason1, DependencyNodeCore`1 reason2) in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler.DependencyAnalysisFramework\DependencyAnalyzer.cs:line 366
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependenciesImpl(DependencyNodeCore`1 node) in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler.DependencyAnalysisFramework\DependencyAnalyzer.cs:line 186
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler.DependencyAnalysisFramework\DependencyAnalyzer.cs:line 319
at ILCompiler.RyuJitCompilation.CompileInternal(String outputFile, ObjectDumper dumper) in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler.RyuJit\Compiler\RyuJitCompilation.cs:line 88
at ILCompiler.Compilation.ILCompiler.ICompilation.Compile(String outputFile, ObjectDumper dumper) in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler.Compiler\Compiler\Compilation.cs:line 526
at ILCompiler.Program.Run(String[] args) in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler\Program.cs:line 892
at ILCompiler.Program.Main(String[] args) in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler\Program.cs:line 1075
---- DEBUG ASSERTION FAILED ----
---- Assert Short Message ----
---- Assert Long Message ----
at Internal.TypeSystem.TypeSystemComparer.Compare(MethodDesc x, MethodDesc y) in D:\source\repos\dotnet\runtime\src\coreclr\tools\Common\TypeSystem\Sorting\TypeSystemComparer.cs:line 90
at ILCompiler.DependencyAnalysis.MethodCodeNode.CompareToImpl(ISortableNode other, CompilerComparer comparer) in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler.RyuJit\Compiler\DependencyAnalysis\MethodCodeNode.cs:line 300
at ILCompiler.DependencyAnalysis.SortableDependencyNode.ObjectNodeComparer.Compare(DependencyNodeCore`1 x1, DependencyNodeCore`1 y1) in D:\source\repos\dotnet\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\SortableDependencyNode.cs:line 147
at ILCompiler.Sorting.Implementation.MergeSortCore`5.Merge(T[] localCopyOfHalfOfArray, TDataStructure arrayToSort, Int32 index, Int32 halfLen, Int32 length, TComparer comparer) in D:\source\repos\dotnet\runtime\src\coreclr\tools\Common\Sorting\MergeSortCore.cs:line 89
at ILCompiler.Sorting.Implementation.MergeSortCore`5.ParallelSort(TDataStructure arrayToSort, Int32 index, Int32 length, TComparer comparer) in D:\source\repos\dotnet\runtime\src\coreclr\tools\Common\Sorting\MergeSortCore.cs:line 49
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.<>c.b__12_0(Action innerContinuation, Task innerTask)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining)
at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult()
at ILCompiler.Sorting.Implementation.MergeSortCore`5.ParallelSort(TDataStructure arrayToSort, Int32 index, Int32 length, TComparer comparer) in D:\source\repos\dotnet\runtime\src\coreclr\tools\Common\Sorting\MergeSortCore.cs:line 51
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.<>c.b__12_0(Action innerContinuation, Task innerTask)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining)
at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
at System.Threading.Tasks.UnwrapPromise`1.TrySetFromTask(Task task, Boolean lookForOce)
at System.Threading.Tasks.UnwrapPromise`1.Invoke(Task completingTask)
at System.Threading.Tasks.Task.RunOrQueueCompletionAction(ITaskCompletionAction completionAction, Boolean allowInlining)
at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult()
at ILCompiler.Sorting.Implementation.MergeSortCore`5.ParallelSort(TDataStructure arrayToSort, Int32 index, Int32 length, TComparer comparer) in D:\source\repos\dotnet\runtime\src\coreclr\tools\Common\Sorting\MergeSortCore.cs:line 51
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.<>c.b__12_0(Action innerContinuation, Task innerTask)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining)
at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
at System.Threading.Tasks.UnwrapPromise`1.TrySetFromTask(Task task, Boolean lookForOce)
at System.Threading.Tasks.UnwrapPromise`1.Invoke(Task completingTask)
at System.Threading.Tasks.Task.RunOrQueueCompletionAction(ITaskCompletionAction completionAction, Boolean allowInlining)
at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult()
at ILCompiler.Sorting.Implementation.MergeSortCore`5.ParallelSort(TDataStructure arrayToSort, Int32 index, Int32 length, TComparer comparer) in D:\source\repos\dotnet\runtime\src\coreclr\tools\Common\Sorting\MergeSortCore.cs:line 51
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.<>c.b__12_0(Action innerContinuation, Task innerTask)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining)
at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
at System.Threading.Tasks.UnwrapPromise`1.TrySetFromTask(Task task, Boolean lookForOce)
at System.Threading.Tasks.UnwrapPromise`1.Invoke(Task completingTask)
at System.Threading.Tasks.Task.RunOrQueueCompletionAction(ITaskCompletionAction completionAction, Boolean allowInlining)
at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult()
at ILCompiler.Sorting.Implementation.MergeSortCore`5.ParallelSort(TDataStructure arrayToSort, Int32 index, Int32 length, TComparer comparer) in D:\source\repos\dotnet\runtime\src\coreclr\tools\Common\Sorting\MergeSortCore.cs:line 51
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.<>c.b__12_0(Action innerContinuation, Task innerTask)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining)
at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
at System.Threading.Tasks.UnwrapPromise`1.TrySetFromTask(Task task, Boolean lookForOce)
at System.Threading.Tasks.UnwrapPromise`1.Invoke(Task completingTask)
at System.Threading.Tasks.Task.RunOrQueueCompletionAction(ITaskCompletionAction completionAction, Boolean allowInlining)
at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult()
at ILCompiler.Sorting.Implementation.MergeSortCore`5.ParallelSort(TDataStructure arrayToSort, Int32 index, Int32 length, TComparer comparer) in D:\source\repos\dotnet\runtime\src\coreclr\tools\Common\Sorting\MergeSortCore.cs:line 51
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.<>c.b__12_0(Action innerContinuation, Task innerTask)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining)
at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
at System.Threading.Tasks.UnwrapPromise`1.TrySetFromTask(Task task, Boolean lookForOce)
at System.Threading.Tasks.UnwrapPromise`1.ProcessInnerTask(Task task)
at System.Threading.Tasks.UnwrapPromise`1.ProcessCompletedOuterTask(Task task)
at System.Threading.Tasks.UnwrapPromise`1.Invoke(Task completingTask)
at System.Threading.Tasks.Task.RunOrQueueCompletionAction(ITaskCompletionAction completionAction, Boolean allowInlining)
at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task.FinishStageThree()
at System.Threading.Tasks.Task.FinishStageTwo()
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
at System.Threading.Tasks.Task.ExecuteEntryUnsafe(Thread threadPoolThread)
at System.Threading.Tasks.Task.ExecuteFromThreadPool(Thread threadPoolThread)
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
at System.Threading.Thread.StartCallback()
---- DEBUG ASSERTION FAILED ----
---- Assert Short Message ----
---- Assert Long Message ----
at ILCompiler.DependencyAnalysis.SortableDependencyNode.ObjectNodeComparer.Compare(DependencyNodeCore`1 x1, DependencyNodeCore`1 y1) in D:\source\repos\dotnet\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\SortableDependencyNode.cs:line 147
at ILCompiler.Sorting.Implementation.MergeSortCore`5.Merge(T[] localCopyOfHalfOfArray, TDataStructure arrayToSort, Int32 index, Int32 halfLen, Int32 length, TComparer comparer) in D:\source\repos\dotnet\runtime\src\coreclr\tools\Common\Sorting\MergeSortCore.cs:line 89
at ILCompiler.Sorting.Implementation.MergeSortCore`5.ParallelSort(TDataStructure arrayToSort, Int32 index, Int32 length, TComparer comparer) in D:\source\repos\dotnet\runtime\src\coreclr\tools\Common\Sorting\MergeSortCore.cs:line 49
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.<>c.b__12_0(Action innerContinuation, Task innerTask)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining)
at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult()
at ILCompiler.Sorting.Implementation.MergeSortCore`5.ParallelSort(TDataStructure arrayToSort, Int32 index, Int32 length, TComparer comparer) in D:\source\repos\dotnet\runtime\src\coreclr\tools\Common\Sorting\MergeSortCore.cs:line 51
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.<>c.b__12_0(Action innerContinuation, Task innerTask)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining)
at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
at System.Threading.Tasks.UnwrapPromise`1.TrySetFromTask(Task task, Boolean lookForOce)
at System.Threading.Tasks.UnwrapPromise`1.Invoke(Task completingTask)
at System.Threading.Tasks.Task.RunOrQueueCompletionAction(ITaskCompletionAction completionAction, Boolean allowInlining)
at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult()
at ILCompiler.Sorting.Implementation.MergeSortCore`5.ParallelSort(TDataStructure arrayToSort, Int32 index, Int32 length, TComparer comparer) in D:\source\repos\dotnet\runtime\src\coreclr\tools\Common\Sorting\MergeSortCore.cs:line 51
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.<>c.b__12_0(Action innerContinuation, Task innerTask)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining)
at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
at System.Threading.Tasks.UnwrapPromise`1.TrySetFromTask(Task task, Boolean lookForOce)
at System.Threading.Tasks.UnwrapPromise`1.Invoke(Task completingTask)
at System.Threading.Tasks.Task.RunOrQueueCompletionAction(ITaskCompletionAction completionAction, Boolean allowInlining)
at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult()
at ILCompiler.Sorting.Implementation.MergeSortCore`5.ParallelSort(TDataStructure arrayToSort, Int32 index, Int32 length, TComparer comparer) in D:\source\repos\dotnet\runtime\src\coreclr\tools\Common\Sorting\MergeSortCore.cs:line 51
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.<>c.b__12_0(Action innerContinuation, Task innerTask)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining)
at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
at System.Threading.Tasks.UnwrapPromise`1.TrySetFromTask(Task task, Boolean lookForOce)
at System.Threading.Tasks.UnwrapPromise`1.Invoke(Task completingTask)
at System.Threading.Tasks.Task.RunOrQueueCompletionAction(ITaskCompletionAction completionAction, Boolean allowInlining)
at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult()
at ILCompiler.Sorting.Implementation.MergeSortCore`5.ParallelSort(TDataStructure arrayToSort, Int32 index, Int32 length, TComparer comparer) in D:\source\repos\dotnet\runtime\src\coreclr\tools\Common\Sorting\MergeSortCore.cs:line 51
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.<>c.b__12_0(Action innerContinuation, Task innerTask)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining)
at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
at System.Threading.Tasks.UnwrapPromise`1.TrySetFromTask(Task task, Boolean lookForOce)
at System.Threading.Tasks.UnwrapPromise`1.Invoke(Task completingTask)
at System.Threading.Tasks.Task.RunOrQueueCompletionAction(ITaskCompletionAction completionAction, Boolean allowInlining)
at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult()
at ILCompiler.Sorting.Implementation.MergeSortCore`5.ParallelSort(TDataStructure arrayToSort, Int32 index, Int32 length, TComparer comparer) in D:\source\repos\dotnet\runtime\src\coreclr\tools\Common\Sorting\MergeSortCore.cs:line 51
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.<>c.b__12_0(Action innerContinuation, Task innerTask)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining)
at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
at System.Threading.Tasks.UnwrapPromise`1.TrySetFromTask(Task task, Boolean lookForOce)
at System.Threading.Tasks.UnwrapPromise`1.ProcessInnerTask(Task task)
at System.Threading.Tasks.UnwrapPromise`1.ProcessCompletedOuterTask(Task task)
at System.Threading.Tasks.UnwrapPromise`1.Invoke(Task completingTask)
at System.Threading.Tasks.Task.RunOrQueueCompletionAction(ITaskCompletionAction completionAction, Boolean allowInlining)
at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task.FinishStageThree()
at System.Threading.Tasks.Task.FinishStageTwo()
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
at System.Threading.Tasks.Task.ExecuteEntryUnsafe(Thread threadPoolThread)
at System.Threading.Tasks.Task.ExecuteFromThreadPool(Thread threadPoolThread)
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
at System.Threading.Thread.StartCallback()
---- DEBUG ASSERTION FAILED ----
---- Assert Short Message ----
Duplicate node name emitted to file
---- Assert Long Message ----
Symbol Internal_CompilerGenerated__Module___UnmanagedCallingConventionStdCall, Static__IntPtr> has already been written to the output object file obj\x64\Release\net6.0-windows10.0.22000.0\win10-x64\native\ComInteropApp.obj with symbol [S.P.CompilerGenerated]Internal.CompilerGenerated..CalliMarshallingMethodThunk(native int,native int,Guid&,native int&,native int)
at ILCompiler.DependencyAnalysis.ObjectWriter.EmitObject(String objectFilePath, IReadOnlyCollection`1 nodes, NodeFactory factory, ObjectWritingOptions options, IObjectDumper dumper, Logger logger) in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler.Compiler\Compiler\DependencyAnalysis\ObjectWriter.cs:line 1028
at ILCompiler.RyuJitCompilation.CompileInternal(String outputFile, ObjectDumper dumper) in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler.RyuJit\Compiler\RyuJitCompilation.cs:line 103
at ILCompiler.Compilation.ILCompiler.ICompilation.Compile(String outputFile, ObjectDumper dumper) in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler.Compiler\Compiler\Compilation.cs:line 526
at ILCompiler.Program.Run(String[] args) in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler\Program.cs:line 892
at ILCompiler.Program.Main(String[] args) in D:\source\repos\dotnet\runtime\src\coreclr\tools\aot\ILCompiler\Program.cs:line 1075
The unoptimized Microsoft.Windows.SDK.NET.dll: Microsoft.Windows.SDK.NET.dll.zip
The crash with IIDOptimized bits is due to this TODO: https://github.com/dotnet/runtime/blob/4881a639e7c3f27b5a8d2d160e234d8055333cda/src/coreclr/tools/aot/ILCompiler.Compiler/IL/ILImporter.Scanner.cs#L998
@hez2010 Would you mind to make a fix in WinRT that sets beforefieldinit
bit on the GuidPatcher generated types? It will make the generic GuidPatcherImplementationDetails constructors more efficient (and also avoid the compiler crash).
(We will still want to fix the TODO in Scanner.)
and also avoid the compiler crash
I tried emitting beforefieldinit
but the compiler is still crashing.
If the crash is the above assert, that one is likely https://github.com/dotnet/runtimelab/issues/153
I think the assert issue is different from the issue in the top post, and I only saw the assert when I tested against the assembly which was not modified by the IIDOptimizer. As for the issue in the top post, I didn't see any assert before the compiler crash.
I tried emitting beforefieldinit but the compiler is still crashing.
Hmm, no what I have expected. Could you please share the commit for cswinrt fix that you have tried?
I think the assert issue is different from the issue in the top post
Yes, there are two different issues. I am pretty sure we are going to hit the second one with IIDOptimizer too, once the IIDOptimizer issue is resolved.
Could you please share the commit for cswinrt fix that you have tried?
I simply put TypeAttributes.BeforeFieldInit
to every TypeDefinition constructor call.
This is a piece of unimplemented functionality. Fixing this will require compiler work and RyuJIT work.
The simpler repro that doesn't require compiling a 26 MB assembly (that makes our compiler diagnostic tooling run so slow that it's unusable) probably involves a class with a RVA static field + a static constructor.
We tell RyuJIT accessing the RVA static requires an explicit cctor check here:
RyuJIT obeys here:
But impInitClass
wasn't updated for NativeAOT and expects a helper that can initialize a class from a MethodTable
. We don't have such helper. It crashes before we find out there's no helper because the scanner didn't predict the helper in the first place.
In fact, I think this codepath wasn't updated for ReadyToRun either (which is why it was missed for NativeAOT).
We probably can't ReadyToRun compile the assembly either. CORINFO_HELP_INITCLASS doesn't have a mapping in readytorunhelpers.h and doesn't look like a usable helper in ReadyToRun.
It looks like maybe the IID Optimizer tool doesn’t correctly check if it’s already ran on an assembly and something caused it to run on the same assembly multiple times.
Observation based on running ILC. Seems to be multiple runs trigger assertion
On method {[S.P.CompilerGenerated]Internal.CompilerGenerated.<Module>.CalliMarshallingMethodThunk(native int,native int,Guid&,native int&,native int)}
---- DEBUG ASSERTION FAILED ----
---- Assert Short Message ----
---- Assert Long Message ----
at Internal.TypeSystem.TypeSystemComparer.Compare(MethodDesc x, MethodDesc y) in d:\runtime\src\coreclr\tools\Common\TypeSystem\Sorting\TypeSystemComparer.cs:line 90
at ILCompiler.DependencyAnalysis.MethodCodeNode.CompareToImpl(ISortableNode other, CompilerComparer comparer) in d:\runtime\src\coreclr\tools\aot\ILCompiler.RyuJit\Compiler\DependencyAnalysis\MethodCodeNode.cs:line 300
at ILCompiler.DependencyAnalysis.CompilerComparer.Compare(ISortableNode x, ISortableNode y) in d:\runtime\src\coreclr\tools\Common\Compiler\DependencyAnalysis\CompilerComparer.cs:line 29
at System.Collections.Generic.SortedSet`1.AddIfNotPresent(T item)
at ILCompiler.MetadataManager.Graph_NewMarkedNode(DependencyNodeCore`1 obj) in d:\runtime\src\coreclr\tools\aot\ILCompiler.Compiler\Compiler\MetadataManager.cs:line 183
at ILCompiler.UsageBasedMetadataManager.Graph_NewMarkedNode(DependencyNodeCore`1 obj) in d:\runtime\src\coreclr\tools\aot\ILCompiler.Compiler\Compiler\UsageBasedMetadataManager.cs:line 94
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.AddToMarkStack(DependencyNodeCore`1 node, String reason, DependencyNodeCore`1 reason1, DependencyNodeCore`1 reason2) in d:\runtime\src\coreclr\tools\aot\ILCompiler.DependencyAnalysisFramework\DependencyAnalyzer.cs:line 366
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependenciesImpl(DependencyNodeCore`1 node) in d:\runtime\src\coreclr\tools\aot\ILCompiler.DependencyAnalysisFramework\DependencyAnalyzer.cs:line 186
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() in d:\runtime\src\coreclr\tools\aot\ILCompiler.DependencyAnalysisFramework\DependencyAnalyzer.cs:line 319
at ILCompiler.RyuJitCompilation.CompileInternal(String outputFile, ObjectDumper dumper) in d:\runtime\src\coreclr\tools\aot\ILCompiler.RyuJit\Compiler\RyuJitCompilation.cs:line 88
at ILCompiler.Compilation.ILCompiler.ICompilation.Compile(String outputFile, ObjectDumper dumper) in d:\runtime\src\coreclr\tools\aot\ILCompiler.Compiler\Compiler\Compilation.cs:line 526
at ILCompiler.Program.Run(String[] args) in d:\runtime\src\coreclr\tools\aot\ILCompiler\Program.cs:line 893
at ILCompiler.Program.Main(String[] args) in d:\runtime\src\coreclr\tools\aot\ILCompiler\Program.cs:line 1076
The assertion is this: https://github.com/dotnet/runtime/issues/68278#issuecomment-1106111263. There are two calli
s in the app that only differ in their calling conventions and we don't take the calling convention into account.
Does this required to reimplement JIT_InitClass
in C#, or in assembly.
We would need a new ReadyToRun helper that we can give to RyuJIT (and have RyuJIT ask for it), similar to the helpers to get static bases of types (https://github.com/dotnet/runtime/blob/afacf6a99e1b98331af958caec638bd93dc46ffe/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/Target_X64/X64ReadyToRunHelperNode.cs).
If this is blocking you, I think you can safely comment out the // We are not going through a helper. The constructor has to be triggered explicitly.
part mentioned above to avoid the bug. Not triggering the cctor will likely not be observable (it's only observable if the cctor is side effecting and the app expects the side effect - in CsWinRT case it's enough to trigger the cctor once the non-RVA-static fields are accessed).
After I comment out / We are not going through a helper. The constructor has to be triggered explicitly.
I hit assertions here.
seems to be this is not stopping, but just recording if this is ok.
What is the class that hits that (which SortableDependencyNode descendant)? If it's something to do with calli signatures, it's likely just another manifestation of https://github.com/dotnet/runtimelab/issues/153 - two different things compared equal and shouldn't have.
COmmenting out lines from CorInfoImpl.RyuJit.cs
https://github.com/dotnet/runtime/blob/55e2378d86841ec766ee21d5e504d7724c39b53b/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs#L2025-L2029
indeed helps, and compiler do not crash anymore. Should be paired with #70105 if you want to run debug version of ILC.
(WASDK 1.2) with NativeAOT .Net 7.0.2, got below exception during compilation: Are there any known workaround?
1>EXEC : error : One or more errors occurred. (Code generation failed for method '[Microsoft.Windows.SDK.NET]2<TSender,TResult><System.__Canon,System.__Canon>..cctor()') 1>System.AggregateException: One or more errors occurred. (Code generation failed for method '[Microsoft.Windows.SDK.NET]<GuidPatcherImplementationDetails>+<SignatureCache>ABI.Windows.Foundation.TypedEventHandler
2<TSender,TResult><System.Canon,System.Canon>..cctor()')
1> ---> ILCompiler.CodeGenerationFailedException: Code generation failed for method '[Microsoft.Windows.SDK.NET]2<TSender,TResult><System.__Canon,System.__Canon>..cctor()' 1> ---> System.InvalidOperationException: [Microsoft.Windows.SDK.NET]<GuidPatcherImplementationDetails>+<SignatureCache>ABI.Windows.Foundation.TypedEventHandler
2<TSender,TResult><System.Canon,System.Canon>: TypeHandle: [Microsoft.Windows.SDK.NET]2<TSender,TResult><!0_System.__Canon,!1_System.__Canon> 1> at ILCompiler.DependencyAnalysis.PrecomputedDictionaryLayoutNode.GetSlotForEntry(GenericLookupResult) in /_/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/DictionaryLayoutNode.cs:line 230 1> at ILCompiler.Compilation.ComputeGenericLookup(MethodDesc, ReadyToRunHelperId, Object) in /_/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Compilation.cs:line 400 1> at Internal.JitInterface.CorInfoImpl.ComputeLookup(CORINFO_RESOLVED_TOKEN&, Object, ReadyToRunHelperId, CORINFO_LOOKUP&) in /_/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs:line 257 1> at Internal.JitInterface.CorInfoImpl.embedGenericHandle(CORINFO_RESOLVED_TOKEN&, Boolean, CORINFO_GENERICHANDLE_RESULT&) in /_/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs:line 1770 1> at Internal.JitInterface.CorInfoImpl._embedGenericHandle(IntPtr, IntPtr*, CORINFO_RESOLVED_TOKEN*, Byte, CORINFO_GENERICHANDLE_RESULT*) in /_/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs:line 2002 1> --- End of inner exception stack trace --- 1> at Internal.JitInterface.CorInfoImpl.CompileMethodInternal(IMethodNode, MethodIL) in /_/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs:line 380 1> at Internal.JitInterface.CorInfoImpl.CompileMethod(MethodCodeNode, MethodIL ) in /_/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs:line 63 1> at ILCompiler.RyuJitCompilation.CompileSingleMethod(CorInfoImpl, MethodCodeNode) in /_/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs:line 190 1> at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0
1.1.<ForWorker>b__1(RangeWorker&, Int32, Boolean& ) 1> at System.Threading.Tasks.TaskReplicator.Replica.Execute() 1> --- End of inner exception stack trace --- 1> at System.Threading.Tasks.TaskReplicator.Run[TState](ReplicatableUserAction
1, ParallelOptions, Boolean)
1> at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32, Int32, ParallelOptions, Action1, Action
2, Func4, Func
1, Action1) 1>--- End of stack trace from previous location --- 1> at System.Threading.Tasks.Parallel.ThrowSingleCancellationExceptionOrOtherException(ICollection, CancellationToken, Exception) 1> at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32, Int32, ParallelOptions, Action
1, Action2, Func
4, Func1, Action
1)
1> at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable1, ParallelOptions, Action
1, Action2, Action
3, Func4, Func
5, Func1, Action
1)
1> at System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable1, ParallelOptions, Action
1)
1> at ILCompiler.RyuJitCompilation.CompileMultiThreaded(List1) in /_/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs:line 150 1> at ILCompiler.RyuJitCompilation.ComputeDependencyNodeDependencies(List
1) in //src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs:line 140
1> at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() in //src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/DependencyAnalyzer.cs:line 315
1> at ILCompiler.RyuJitCompilation.CompileInternal(String, ObjectDumper) in //src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs:line 88
1> at ILCompiler.Compilation.ILCompiler.ICompilation.Compile(String, ObjectDumper) in //src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Compilation.cs:line 528
1> at ILCompiler.Program.Run(String[]) in //src/coreclr/tools/aot/ILCompiler/Program.cs:line 958
1> at ILCompiler.Program.Main(String[]) in //src/coreclr/tools/aot/ILCompiler/Program.cs:line 1150
1>C:\Program Files\dotnet\sdk\7.0.102\Sdks\Microsoft.DotNet.ILCompiler\build\Microsoft.NETCore.Native.targets(278,5): error MSB3073: The command ""C:\Users\xxx.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\7.0.2\tools\ilc" @"obj\x64\Release\net7.0-windows10.0.22621.0\win10-x64\native\SocketServer.ilc.rsp"" exited with code 1.
Are there any known workaround?
The workaround is to either build your own version of CsWinRt that doesn't generate types with RVA static fields and a class constructor, or build your own version of ILC with the above mentioned line commented out.
CsWinRT has other problems with NativeAOT. It will not work in general so this issue is not a very high priority to fix. We'd appreciate/accept a pull request with a fix for this, but it's not high on our priority list for .NET 8 since there's many other problems that are only fixable on CsWinRT side.
Just hit this as well. Building my own version of Microsoft.Windows.Sdk.NET.Ref seems to be problematic as the assembly is strong named resulting in conflicts with dependencies that compiled against the strong-named version.
That leaves building my own version of ILC. Given that CsWinRT started doing some work to become more compatible with nativeaot, having this fixed would be helpful as CsWinRT would likely be more compatible by the time .NET 8 ships.
Are there any known workaround?
The workaround is to either build your own version of CsWinRt that doesn't generate types with RVA static fields and a class constructor, or build your own version of ILC with the above mentioned line commented out.
CsWinRT has other problems with NativeAOT. It will not work in general so this issue is not a very high priority to fix. We'd appreciate/accept a pull request with a fix for this, but it's not high on our priority list for .NET 8 since there's many other problems that are only fixable on CsWinRT side.
Would the fix for this be to inject a helper instead of setting the CORINFO_FLG_FIELD_INITCLASS flag on line 2028? https://github.com/dotnet/runtime/blob/55e2378d86841ec766ee21d5e504d7724c39b53b/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs#L2025-L2029
or would you want to handle this in GetHelperFtnUncached
I think that after #83911 this already works for optimized builds. You need a recent enough build from main. It's still going to crash for debug builds because #83911 doesn't kick in when not optimizing. @EgorBo do you think it would make sense to access statics inline for debug builds as well so we can just resolve this with that?
The problem here is that there is a class with a static constructor and a RVA static field. And we're accessing the RVA static field so we need a cctor check. The ReadyToRun codepaths in JIT/EE don't have handling for this since it's not expressible in C#. I'm adding an IL test for this in #86081 and fixing a minor issue that likely won't cause problems in CsWinRT (but it does cause a problem for the test).
I think that after #83911 this already works for optimized builds. You need a recent enough build from main. It's still going to crash for debug builds because #83911 doesn't kick in when not optimizing. @EgorBo do you think it would make sense to access statics inline for debug builds as well so we can just resolve this with that?
The problem here is that there is a class with a static constructor and a RVA static field. And we're accessing the RVA static field so we need a cctor check. The ReadyToRun codepaths in JIT/EE don't have handling for this since it's not expressible in C#. I'm adding an IL test for this in #86081 and fixing a minor issue that likely won't cause problems in CsWinRT (but it does cause a problem for the test).
Yes, I think I can make it mandatory for all configs (we do the same for runtime lookup and assert if we didn't "expand" some). Currently we don't expand thes static cctor checks for Non-optimized code and for cold blocks. Let me know if you want me to file a PR now
Still hitting this issue even after https://github.com/dotnet/runtime/pull/83911 when I try to root the whole Microsoft.WinUI.dll.
Yes, I think I can make it mandatory for all configs (we do the same for runtime lookup and assert if we didn't "expand" some). Currently we don't expand thes static cctor checks for Non-optimized code and for cold blocks. Let me know if you want me to file a PR now
I think it would be fine to always expend this. Then we can delete the assembly helpers from ILCompiler and it will also fix this issue with an RVA static field + cctor. I prefer fixing things by making the product simpler if possible.
Still hitting this issue even after https://github.com/dotnet/runtime/pull/83911 when I try to root the whole Microsoft.WinUI.dll.
Sigh, then we'll just keep this open. I'm not planning to look at these problems further though because I don't see much progress in making CsWinRT AOT safe.
@MichalStrehovsky it is a new exception, not the previous one.
Error: Specified cast is not valid.
System.InvalidCastException: Specified cast is not valid.
at System.Runtime.TypeCast.CheckCastClass(MethodTable*, Object) + 0x31
at ILCompiler.MetadataManager.IsReflectionBlocked(TypeDesc) + 0x132
at ILCompiler.MetadataManager.IsReflectionBlocked(Instantiation) + 0x30
at ILCompiler.MetadataManager.IsReflectionBlocked(TypeDesc) + 0xfc
at ILCompiler.UsageBasedMetadataManager.HasConditionalDependenciesDueToEETypePresence(TypeDesc) + 0xec
at ILCompiler.DependencyAnalysis.EETypeNode..ctor(NodeFactory, TypeDesc) + 0xfd
at ILCompiler.DependencyAnalysis.NodeFactory.CreateNecessaryTypeNode(TypeDesc) + 0xf1
at Internal.TypeSystem.LockFreeReaderHashtable`2.CreateValueAndEnsureValueIsInTable(TKey) + 0x11
at ILCompiler.DependencyAnalysis.NodeFactory.NecessaryTypeSymbol(TypeDesc) + 0x95
at ILCompiler.DependencyAnalysis.NonGCStaticsNode.GetConditionalStaticDependencies(NodeFactory) + 0x32
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependenciesImpl(DependencyNodeCore`1) + 0xf3
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependencies(DependencyNodeCore`1) + 0x32
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ProcessMarkStack() + 0xb5
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() + 0x50
at ILCompiler.ILScanner.ILCompiler.IILScanner.Scan() + 0x14
at ILCompiler.Program.<Run>g__RunScanner|3_0(Program.<>c__DisplayClass3_0&) + 0x108
at ILCompiler.Program.Run() + 0x145c
at ILCompiler.ILCompilerRootCommand.<>c__DisplayClass203_0.<.ctor>b__0(InvocationContext context) + 0x20c
I submit a PR (https://github.com/microsoft/CsWinRT/pull/1340) to fix this pattern in CsWinRT. Should we keep this issue open after PR merged?
@MichalStrehovsky it is a new exception, not the previous one.
Does https://github.com/microsoft/CsWinRT/pull/1340 fix this issue? If yes, pretty sure the issue is https://github.com/dotnet/runtime/pull/86081#discussion_r1190647469. I'd close this then and wait if someone ever puts RVA static fields on a generic type with a cctor again. It is not worth the hassle if the only known generator is getting fixed up not to do that. Thanks for fixing it!
Does microsoft/CsWinRT#1340 fix this issue?
Yes. I'll link this issue from the PR.
@MichalStrehovsky it is a new exception, not the previous one.
Error: Specified cast is not valid. System.InvalidCastException: Specified cast is not valid. at System.Runtime.TypeCast.CheckCastClass(MethodTable*, Object) + 0x31 at ILCompiler.MetadataManager.IsReflectionBlocked(TypeDesc) + 0x132 at ILCompiler.MetadataManager.IsReflectionBlocked(Instantiation) + 0x30 at ILCompiler.MetadataManager.IsReflectionBlocked(TypeDesc) + 0xfc at ILCompiler.UsageBasedMetadataManager.HasConditionalDependenciesDueToEETypePresence(TypeDesc) + 0xec at ILCompiler.DependencyAnalysis.EETypeNode..ctor(NodeFactory, TypeDesc) + 0xfd at ILCompiler.DependencyAnalysis.NodeFactory.CreateNecessaryTypeNode(TypeDesc) + 0xf1 at Internal.TypeSystem.LockFreeReaderHashtable`2.CreateValueAndEnsureValueIsInTable(TKey) + 0x11 at ILCompiler.DependencyAnalysis.NodeFactory.NecessaryTypeSymbol(TypeDesc) + 0x95 at ILCompiler.DependencyAnalysis.NonGCStaticsNode.GetConditionalStaticDependencies(NodeFactory) + 0x32 at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependenciesImpl(DependencyNodeCore`1) + 0xf3 at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependencies(DependencyNodeCore`1) + 0x32 at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ProcessMarkStack() + 0xb5 at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() + 0x50 at ILCompiler.ILScanner.ILCompiler.IILScanner.Scan() + 0x14 at ILCompiler.Program.<Run>g__RunScanner|3_0(Program.<>c__DisplayClass3_0&) + 0x108 at ILCompiler.Program.Run() + 0x145c at ILCompiler.ILCompilerRootCommand.<>c__DisplayClass203_0.<.ctor>b__0(InvocationContext context) + 0x20c
I have this exact error message in my build output when I try to compile my MAUI app with the latest .Net 8 Preview 6 for Windows and AOT enabled. I must admit I understand less than half of what was discussed here in the issue, but can someone point me to a workaround for making this work with MAUI?
I have this exact error message in my build output when I try to compile my MAUI app with the latest .Net 8 Preview 6 for Windows and AOT enabled. I must admit I understand less than half of what was discussed here in the issue, but can someone point me to a workaround for making this work with MAUI?
Based on above, this was fixed in CsWinRT, so my guess is that this is still using CsWinRT somewhere and it's an old version.
CsWinRT hasn't released a new version that contains this fix. You will need to wait for a new release.
Any update on this?
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: