Nunit loading loading exe

following situation:

  • tests.dll contains a bunch of unit tests

  • program.exe contains some of them for testing classes

  • tests.dll contains tests using the classes in program.exe

  • therefore test.dll has a link to program.exe

  • nunit-agent.exe loads test.dll and then loads program.exe

-> mainly in the environment nunit program.exe is used as a dll. "misusing" exe as a dll is possible since I just wrote a small test application that also references program.exe and uses some of the classes defined there, and it works fine ...

BUT in nunit I get a BadImageFormatException exception as soon as tests that use the code defined in program.exe are loaded

Is this a mistake in the nunit reflection mechanism, or is there a reason for this?

Thx toby

+3
source share
1 answer

This can happen if .exe is compiled for x86 and you run tests on a 64-bit OS. If so, you can use nunit-x86.exe to run the tests.

+5
source

Source: https://habr.com/ru/post/1763813/


All Articles