How to debug flaky BadImageFormatExceptions? #121811
Unanswered
Dimension4
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey guys,
I'm currently trying to figure out a bug that happens occasionally on the macOS CI pipeline that I have at work. Basically, at seemingly random CI runs, the dotnet tests fail in one specific test project (all tests in that project fail) with a
BadImageFormatException. The detailed reason seems to vary a bit. Sometimes it's "corrupt metadata", sometimes "bad token", and one or two other ones I can't remember at the moment (I'm citing from memory here so the quotes are probably not 100% accurate).We did quite a bit of debugging on different CI agents and local machines and here is what we found out:
dotnet test --no-build, so testing shouldn't change the binary. When I rundotnet test --no-buildin a loop with the exact same command line arguments and environment, the tests will sometimes pass and sometimes throw (throw happens roughly 20% of the time).dotnet testdirectly on the dll (or group of dlls) will always pass the tests.Has anyone an idea how to debug this further?
I will try to get a debugger attached to the process when it happens but I haven't managed to do so yet.
Are there any environment variables or flags for the runtime that I could use to get more information about what exactly failed? Maybe an unmanaged stack trace of the runtime itself when it generates the managed exceptions? Some extra logging?
Any help or idea is appreciated.
Beta Was this translation helpful? Give feedback.
All reactions