Skip to content

AndroidStripILAfterAOT causing "InvalidProgramException: Invalid IL code in Xunit.Assert:True(bool)" #103782

@tranb3r

Description

@tranb3r

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

  1. Open repro in visual studio.
  2. Run app in Release on android emulator.
  3. Run all tests: one of the test fails.
  4. Run all tests again: both tests succeed.

Did you find any workaround?

Remove AndroidStripILAfterAOT=true.

Relevant log output

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions