-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Exception in clrjit.dll when using .NET 9.0 #113369
Comments
Does not repro for me in .NET 9.0 and Release assuming I repeated the steps correctly I changed TFM to net9.0 for |
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
The problem is with the TestApp. Use DllExport to reproduce the problem, DebugTestApp fails, DebugTestApp.NET8 works. NetApp is only used to show that somehow the problem is dependent on the application calling the dll. You can also test it by starting TestApp directly from the browser. DllExportTest\bin\Release\TestApp.exe will fail. |
@melfon not sure I follow - I cloned you rerpo with C# and C++ project. but then there is also a standalone binary (it's not managed) - is there a source for it? |
I can repro, the error is in profile synthesis:
Here @melfon I wonder if something in the host changes the FP exception modes. Normally this computation would not raise an exception and just compute infinity. |
@EgorBo The problem is that sometimes I have external apps, in this case the TestApp that will load a dll. Use configuration DebugTestApp with DllExport project and you should be able to reproduce the error. |
That at least explains the division by zero. |
See for example the discussion in #109997 -- if you want to modify FP exceptional behavior you have to be careful to restore it before invoking any .NET code. |
Ok, now I understand. So there is a difference in behavior between NET8 and NET9. To get this working in NET9, the main application has to disable zero division checks. I recompiled TestApp.exe and got it working. This could cause a problem for older apps that can not be recompiled. |
AFAIK this FP mode sensitivity is not a new requirement in .NET 9. But in .NET 9 it may now be exposed in more places. |
Though it looks like as good citizens we should probably avoid depending on divide by zero in that one spot in the JIT. I will put up a PR, though not sure if it will qualify for backporting to .NET 9. |
This can trip up users that have enabled floating point exceptions. While we don't generally support changing the exception modes we also can easily avoid dividing by zero here. Addresses dotnet#113369
This can trip up users that have enabled floating point exceptions. While we don't generally support changing the exception modes we also can easily avoid dividing by zero here. Addresses #113369
@AndyAyersMS Thanks for the support and quick response! |
This can trip up users that have enabled floating point exceptions. While we don't generally support changing the exception modes we also can easily avoid dividing by zero here. Addresses #113369
FYI I have put this up for consideration as a .NET 9 fix: #113418 -- will update this once a decision is made. |
Description
Fail to open an dll built with .NET 9.0 /clr:netcore.
It works fine with .NET 8.0, but with .NET 9.0 it only works during debugging and if Suppress JIT optimization on module load is enabled. It never works in release.
It is somehow connected to the main application loading the dll. It works if the main app is written in C#.
Reproduction Steps
Created a simple app to reproduce the problem.
DllExport
Run DebugTestApp to see the problem. Debug uses NetApp, which works.
Works fine if using .NET 8, but crashes if using .NET 9.
Expected behavior
As with .NET 8.0
Actual behavior
Regression?
Works with .NET 8
Known Workarounds
Enable Suppress JIT optimization on module load in VS to get it working during debugging within VS. It never works in release.
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: