-
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
native aot regression in .net 8.0 #91065
Comments
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue DetailsDescriptioni am using this library to generate strings with templates. it can work fine using JsonDocument as the model under native aot with .net 7. however, somehow when i upgraded my dotnet version to 8.0 it breaks with Reproduction Steps
Expected behaviorworks on net 8.0 Actual behaviorcrashed under native aot Regression?net 7.0 Known WorkaroundsNo response ConfigurationNo response Other informationNo response
|
it seems that this also works on net 8.0 preview 4. from preview 5 all the way to preview 7 it broke.
|
The problem seems to be that the app is using Linq Expressions in a trim-incompatible way. The exception is:
This is likely to produce random failures -- either the program happens to visit all the necessary types that LINQ needs and everything works, or it doesn't keep the right thing, and the app crashes, like this. My suspicion is that we have made some improvements in the LINQ area to trim even more unnecessary code away. The app may have been relying on that code to be present. |
The app produces AOT compatibility warnings when published for AOT. Our design is that we only guarantee compatibility if there are no warnings. Apps which produce warnings may work, but we're free to break them with upcoming releases. Andy is right that the likely reason in this case is something around Linq.Expressions changed, but it's not a bug in the system - the design is such that if there are warnings the compiler is free to change the behavior if it's beneficial for other reasons. |
thank you for the responses. is there any templating library that is aot friendly currently on dotnet? |
|
I have a fix at #91382, thanks for the report! The warnings muddied the water a bit - what others said is true though - if there are warnings generated, the code is not AOT friendly and may not work in general. You need to thoroughly test with AOT enabled. It is not a great experience. With the fix, the demo app seems to work though. |
thanks a lot @MichalStrehovsky. can i expect the fix to be in rc1? i will close this issue now. |
Let's not close before it merges (github will autoclose on merge). I don't think it will make RC1. Looks like RC2 at this point. |
ah okay thats fine |
Description
i am using this library to generate strings with templates. it can work fine using JsonDocument as the model under native aot with .net 7. however, somehow when i upgraded my dotnet version to 8.0 it breaks with
System.ArgumentException: The handle is invalid.
. i know that this library does not support native aot directly but im sure this is a regression bug in .netReproduction Steps
nativeaot.zip
dotnet publish -c Release
and run the generated binary.TargetFramework
tonet7.0
to make it work.Expected behavior
works on net 8.0
Actual behavior
crashed under native aot
Regression?
net 7.0
Known Workarounds
No response
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: