C
C#2y ago
wellen.

❔ Bad IL Format Exception when porting .NET Framework 4.8 Project to .NET Core 6.0

Hi, I've currently got the glorious task to port a .NET Framework 4.8 project to .NET Core 6.0. So far so good. No exceptions anywhere anymore, most of the warnings are gone. Majority of Unit Tests are running through. Except for those 28 Unit Tests that toss me a "Bad IL Format" exception. I've tried building and running the Unit Tests isolated in x86, x64, and a mix of both, as well as AnyCPU. Each of these Unit Tests fail at the same point, and for the same reason. Debugging the code step by step does not give me a lot of information either, hence why I'll refrain from posting any code here for now. I've also tried running the Tests in different test engines, all of them toss the same issue. These Unit Tests don't fail with .NET Framework 4.8, so it is definitely some issue caused by migrating to .NET Core 6.0. I've been through a ship load of google results, and none helped me so far. Has anyone of you ever encountered this issue, and resolved it?
8 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
wellen.
wellen.OP2y ago
System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
----> System.BadImageFormatException : Bad IL format.
System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
----> System.BadImageFormatException : Bad IL format.
Set the engine mode and configuration of ncrunch as well as solution build all to x64, to enforce it to be built in 64 bit, as well as x86 before. And also tried all combinations of x86 and x64 for the respective projects in the solution, each time they fail due to that. I have to note: The project, even back in .NET Framework 4.8, was forced to run only in x64.
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
wellen.
wellen.OP2y ago
Did that. 😛
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
wellen.
wellen.OP2y ago
Still not working, nope.
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server