You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running benchmarks against .NET 9 RC1 AoT, I encountered an InvalidCastException on the generated project.
This issue seems to be related to/triggered by the <IlcGenerateCompleteTypeMetadata> property in the auto-generated .csproj file.
Observe the exception being thrown during the build process.
[G:\eNeRGy164\AdventOfPerformance\AdventOfPerformance\bin\Release\net9.0\dc62efe0-07da-4394-9f10-feb11cf922fe\BenchmarkDotNet.Autogenerated.csproj] Generating native codeEXEC : error : Specified cast is not valid. [G:\eNeRGy164\AdventOfPerformance\AdventOfPerformance\bin\Release\net9.0\dc62efe0-07da-4394-9f10-feb11cf922fe\BenchmarkDotNet.Autogenerated.csproj] System.InvalidCastException: Specified cast is not valid. at ILCompiler.CompilerTypeSystemContext.EnsureLoadableTypeUncached(TypeDesc) + 0x3eb at ILCompiler.CompilerTypeSystemContext.EnsureLoadableType(TypeDesc) + 0x5a at ILCompiler.LibraryRootProvider.CheckCanGenerateMethod(MethodDesc) + 0x4c at ILCompiler.DependencyAnalysis.TypeMetadataNode.GetStaticDependencies(NodeFactory) + 0x48a at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependenciesImpl(DependencyNodeCore`1) + 0x56 at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependencies(DependencyNodeCore`1) + 0xce at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ProcessMarkStack() + 0xed at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() + 0x49 at ILCompiler.ILScanner.ILCompiler.IILScanner.Scan() + 0x1b at ILCompiler.Program.<Run>g__RunScanner|4_0(Program.<>c__DisplayClass4_0&) + 0x1fa at ILCompiler.Program.Run() + 0x28ff at ILCompiler.ILCompilerRootCommand.<>c__DisplayClass240_0.<.ctor>b__0(ParseResult) + 0x321C:\Users\micha\.nuget\packages\microsoft.dotnet.ilcompiler\9.0.0-rc.1.24431.7\build\Microsoft.NETCore.Native.targets(317,5): error MSB3073: The command ""C:\Users\micha\.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\9.0.0-rc.1.24431.7\tools\\ilc" @"G:\eNeRGy164\AdventOfPerformance\AdventOfPerformance\bin\Release\net9.0\dc62efe0-07da-4394-9f10-feb11cf922fe\obj\Release\net9.0/native\dc62efe0-07da-4394-9f10-feb11cf922fe.ilc.rsp"" exited with code 1. [G:\eNeRGy164\AdventOfPerformance\AdventOfPerformance\bin\Release\net9.0\dc62efe0-07da-4394-9f10-feb11cf922fe\BenchmarkDotNet.Autogenerated.csproj]
Workaround
Removing the <IlcGenerateCompleteTypeMetadata> property from the generated .csproj file resolves the issue, and the .bat file runs without exceptions.
Additional Details
BenchmarkDotNet version: 0.14.0
.NET SDK version: 9.0.100-rc.1.24452.12
This issue does not occur with SDK 8.0 and nativeaot80 or SDK 9.0 RC1 and net90
Link to the branch: net90
I'm not sure if this is a specific BenchmarkDotNet issue,or related to the ILCompiler itself.
The text was updated successfully, but these errors were encountered:
When running benchmarks against .NET 9 RC1 AoT, I encountered an
InvalidCastException
on the generated project.This issue seems to be related to/triggered by the
<IlcGenerateCompleteTypeMetadata>
property in the auto-generated.csproj
file.Steps to Reproduce
Clone https://github.com/eNeRGy164/AdventOfPerformance/tree/net90
Run BenchmarkDotNet with .NET 9 AoT using the command:
dotnet run -c Release -f net9.0 -- --runtimes nativeaot90 --filter *PuzzlePart1Benchmarks*
Observe the exception being thrown during the build process.
Workaround
Removing the
<IlcGenerateCompleteTypeMetadata>
property from the generated.csproj
file resolves the issue, and the.bat
file runs without exceptions.Additional Details
BenchmarkDotNet version: 0.14.0
.NET SDK version: 9.0.100-rc.1.24452.12
This issue does not occur with SDK 8.0 and
nativeaot80
or SDK 9.0 RC1 andnet90
Link to the branch: net90
I'm not sure if this is a specific BenchmarkDotNet issue,or related to the ILCompiler itself.
The text was updated successfully, but these errors were encountered: