-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
AndroidStripILAfterAOT causing "InvalidProgramException: Invalid IL code in Xunit.Assert:True(bool)" #103782
Comments
fyi @vitek-karas |
@fanyang-mono & @vitek-karas could you take a look into this? Thanks! :) |
I will work on this. |
Any update? |
Hi @tranb3r, sorry for the delay. I tried building and running the app that you linked in this issue. I tried with .NET8 sdk and .NET8 service 1 sdk. I was not able to reproduce with either of them. Here are my steps:
Did I miss anything? |
@fanyang-mono |
@tranb3r From |
@fanyang-mono I think you're building for Debug instead of Release. Here is a simple command to build and run the apk:
Here are the corresponding apks:
I've reproduced the error both on x86_64 simulator and arm64-v8a device. |
@tranb3r I was able to reproduce with the apk file that you provided. Will look into it. |
@fanyang-mono Hi, any progress? Thanks |
@tranb3r I was caught up by some other projects. Will find some time to look into this this week. Sorry about the delay. |
@fanyang-mono Sorry to ask again. Did you have the time to work on this issue? Thx. |
@tranb3r I got some time to working on it now. I was able to reproduce it with the app you sent to me. Now I need to understand why that method got trimmed. I would need to build it locally. The repo that you linked originally is not accessible anymore. Did you moved the project to another location? If so, could you please send me a new link? |
The repo has not been moved. |
@fanyang-mono Did you manage to access the repo and rebuild the test app? |
Yes, working on it. |
Hi @fanyang-mono , |
Hi @fanyang-mono |
Hi @jonathanpeppers |
This is still happening with net9-pre4 |
AndroidStripILAfterAOT is an important stopgap before Android gets NativeAOT support. It looks like it won't get NativeAOT support in dotnet 9 and if this issue isn't fixed either, then it will be the only platform where IL is deployed to end-user systems. |
Sorry for the delay. I had to focus on other projects. I am able to focus on this issue now. I did some investigation and found that
This seems to me that when running the test for the first time or invoking |
@tranb3r Do you have an iOS app which the same kind of testing, meaning a few tests within one assembly? If so, are they running fine? |
@fanyang-mono |
There isn't an equivalent for |
Fun news - I believe I can get the same failure on iOS too https://github.com/lambdageek/maui-aot-race The underlying issue is how |
Tagging subscribers to this area: @directhex, @matouskozak |
@fanyang-mono will this fix also resolve #104156? |
@tipa yea that looks related. Our next steps here are to wait for this fix to flow to the Android and ios SDKs and to get some performance benchmarks. If there is negligible performance impact on non-racy code we will try to do a net8.0 backport. |
The fix to this issue is on track to be shipped as part of .NET9 Preview7. Additionally, I've opened an PR to backport this fix to .NET8. |
I've just tested net9-pre7. The fix works on my repro project. Thx. |
Android application type
.NET Android (net7.0-android, net8.0-android, etc.)
Affected platform version
VS 2022 17.8.5
Description
When setting
AndroidStripILAfterAOT=true
in a test app, some tests are failing the first time we run them, but then they'll pass if we run them again.The error is 100% reproducible when starting the app again.
Here is the error:
InvalidProgramException: Invalid IL code in Xunit.Assert:True(bool): method body is empty
.No issue in Debug. No issue when removing
AndroidStripILAfterAOT=true
.This is similar to #104156, but no BroadcastReceiver is involved here.
Steps to Reproduce
Did you find any workaround?
Remove
AndroidStripILAfterAOT=true
.Relevant log output
No response
The text was updated successfully, but these errors were encountered: