-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NativeAOT] When attempting to AOT compile a benchmark System.InvalidCastException: Specified cast is not valid
is thrown
#106439
Comments
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas |
* `llcOptimizationPreference` was renamed to `OptimizationPreference` and became supported in .NET 8 (or maybe .NET 7, it doesn't matter) * `IlcGenerateStackTraceData` is now `StackTraceSupport` and supported. (Also got renamed in .NET 8 or earlier.) I'm leaving the old names of properties for backcompat. We could also delete them. I don't know how much BDN cares about .NET versions that are out of support. IlcGenerateCompleteTypeMetadata is unsupported, we don't test it, it's a mode for troubleshooting trimming issues for people who ignore trimming warnings. I don't think BDN should be setting this. You'll only find bugs (dotnet/runtime#106439). So deleting that. Not deleting the API because it looks to be a public API.
BDN is running into this because it sets an unsupported flag that we don't test. This will require a fix in BDN. I'm going to fix this in the compiler too, but since we already snapped for .NET 9 and this is in an unsupported switch, the fix will probably not meet the bar for 9.0 at this point. BDN fix: dotnet/BenchmarkDotNet#2616 |
…teTypesOnly` is specified Fixes dotnet#106439. This is an unsupported flag that allows generating unusable metadata for type members that would have been trimmed. This is useful when troubleshooting trimming issues for people who ignore trimming warnings because it converts random `NullReferenceException` (e.g. `GetMethod` returned null and the program didn't check for it) into "Foo.Bar wasn't generated" exceptions. Because this isn't tested, we regressed this. The code that checks whether it's possible to generate the metadata for the member at all stopped working for uninstantiated generics. This check is needed to deal with invalid input IL.
@neon-sunset it might be possible to work around this with existing version of BDN: it seems like IlcGenerateCompleteTypeMetadata (the problematic switch that BDN sets to true and triggering the bug) seems to be somehow configurable on the BDN side. Don't know enough about BDN to give you instructions though. |
Thanks a lot! |
* Clean up unsupported native AOT flags * `llcOptimizationPreference` was renamed to `OptimizationPreference` and became supported in .NET 8 (or maybe .NET 7, it doesn't matter) * `IlcGenerateStackTraceData` is now `StackTraceSupport` and supported. (Also got renamed in .NET 8 or earlier.) I'm leaving the old names of properties for backcompat. We could also delete them. I don't know how much BDN cares about .NET versions that are out of support. IlcGenerateCompleteTypeMetadata is unsupported, we don't test it, it's a mode for troubleshooting trimming issues for people who ignore trimming warnings. I don't think BDN should be setting this. You'll only find bugs (dotnet/runtime#106439). So deleting that. Not deleting the API because it looks to be a public API. Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com>
Description
It appears that with the current RC.1 build it is impossible to build AOT benchmarks with BenchmarkDotNet due to an exception that occurs within ILC.
Reproduction Steps
dotnet new console
dotnet add package BenchmarkDotNet
(0.14.0)dotnet run -c Release
Expected behavior
Benchmark successfully runs
Actual behavior
An exception is thrown:
Regression?
Yes
Known Workarounds
None that I'm aware of
Configuration
Other information
No response
The text was updated successfully, but these errors were encountered: