Skip to content

[NativeAOT] ILCompiler - WinUI - Specified cast is not valid #122055

@sdanev

Description

@sdanev

Description

I am getting the flowing error when using true.
Check the build error log:

Reproduction Steps

Publish AOT

Expected behavior

NativeAOT publish completes, producing a native DLL (or, at minimum, fails with a diagnostic pointing to the problematic code).

Actual behavior

1>CSC : warning AD0001: Analyzer 'ILLink.RoslynAnalyzer.DynamicallyAccessedMembersAnalyzer' threw an exception of type 'System.InvalidCastException' with message 'Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Symbols.PublicModel.PropertySymbol' to type 'Microsoft.CodeAnalysis.IMethodSymbol'.'.
1> 0 IID calculations/fetches patched
1> DApp -> C:\xxxxxxx\xxxxxxx\bin\x64\Release\net10.0-windows10.0.26100.0\win-x64\DApp.dll
1> Generating native code
1>ILC : warning IL2037: Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ExecuteUpdateAsync(IQueryable1<TSource>,Action1<UpdateSettersBuilder1<TSource>>,CancellationToken): No members were resolved for 'ExecuteUpdate``1(System.Linq.IQueryable{``1},System.Collections.Generic.IReadOnlyList{ITuple})' on type 'Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions'. 1>EXEC : error : Specified cast is not valid. 1> System.InvalidCastException: Specified cast is not valid. 1> at ILCompiler.CompilerTypeSystemContext.EnsureLoadableTypeUncached(TypeDesc) + 0x2ab 1> at ILCompiler.CompilerTypeSystemContext.EnsureLoadableType(TypeDesc) + 0x5a 1> at ILCompiler.CompilerTypeSystemContext.EnsureLoadableTypeUncached(TypeDesc) + 0x351 1> at ILCompiler.CompilerTypeSystemContext.EnsureLoadableType(TypeDesc) + 0x5a 1> at ILCompiler.CompilerTypeSystemContext.EnsureLoadableTypeUncached(TypeDesc) + 0x258 1> at ILCompiler.CompilerTypeSystemContext.EnsureLoadableType(TypeDesc) + 0x5a 1> at ILCompiler.DependencyAnalysis.NodeFactory.<CreateNodeCaches>b__47_29(TypeDesc) + 0x17 1> at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey, Func2) + 0xbd 1> at ILCompiler.DependencyAnalysis.TypeMetadataNode.GetMetadataDependencies(DependencyNodeCore1.DependencyList&, NodeFactory, TypeDesc, String) + 0x125
1> at ILCompiler.DependencyAnalysis.MethodMetadataNode.GetStaticDependencies(NodeFactory) + 0x4d3
1> at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer2.GetStaticDependenciesImpl(DependencyNodeCore1) + 0x56
1> at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer2.ProcessMarkStack() + 0xf4 1> at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer2.ComputeMarkedNodes() + 0x49
1> at ILCompiler.ILScanner.ILCompiler.IILScanner.Scan() + 0x5e5
1> at ILCompiler.Program.g__RunScanner|4_0(Program.<>c__DisplayClass4_0&) + 0x19a
1> at ILCompiler.Program.Run() + 0x2af3
1> at ILCompiler.ILCompilerRootCommand.<>c__DisplayClass261_0.<.ctor>b__0(ParseResult) + 0x31f
1>C:\xxxxxxx.nuget\packages\microsoft.dotnet.ilcompiler\10.0.0\build\Microsoft.NETCore.Native.targets(330,5): error MSB3073: The command ""C:\xxxxxxx.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\10.0.0\tools\ilc" @"obj\x64\Release\net10.0-windows10.0.26100.0\win-x64\native\DApp.ilc.rsp"" exited with code 1.

Regression?

No response

Known Workarounds

No response

Configuration

.Net 10
net10.0-windows10.0.26100.0

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions