-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed as not planned
Closed as not planned
Copy link
Labels
Description
I have followed the guide here https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/?tabs=net7 to try compile our app with Native AOT on .NET 8 Preview 6. However, I am getting this error:
EXEC : error : Specified cast is not valid. [C:\git\MyApp.csp
roj::TargetFramework=net8.0-windows10.0.19041.0]
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) + 0x3d
at ILCompiler.MetadataManager.IsReflectionBlocked(TypeDesc) + 0xfc
at ILCompiler.UsageBasedMetadataManager.HasConditionalDependenciesDueToEETypePresence(TypeDesc) + 0xec
at ILCompiler.DependencyAnalysis.EETypeNode..ctor(NodeFactory, TypeDesc) + 0x10a
at ILCompiler.DependencyAnalysis.NodeFactory.CreateNecessaryTypeNode(TypeDesc) + 0xfb
at Internal.TypeSystem.LockFreeReaderHashtable`2.CreateValueAndEnsureValueIsInTable(TKey) + 0x11
at ILCompiler.DependencyAnalysis.NodeFactory.NecessaryTypeSymbol(TypeDesc) + 0xe7
at ILCompiler.DependencyAnalysis.NonGCStaticsNode.GetConditionalStaticDependencies(NodeFactory) + 0x32
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependenciesImpl(DependencyNodeCore`1) + 0
xf3
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependencies(DependencyNodeCore`1) + 0x2b
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|4_0(Program.<>c__DisplayClass4_0&) + 0x192
at ILCompiler.Program.Run() + 0x1f9b
at ILCompiler.ILCompilerRootCommand.<>c__DisplayClass215_0.<.ctor>b__0(InvocationContext context) + 0x2f8
How can I find out more information of what this means and how it can be fixed? The publish command I used is: dotnet publish -f:net8.0-windows10.0.19041.0 -r:win10-x64 -c:Release