Remco;2142 wrote:
It looks to me like there may be an issue with the same assembly being loaded into the application domain twice. You may be able to confirm or deny this by stepping with the debugger to the exception point, then checking the list of loaded modules for duplicates.
Breaking in the execution of the test doesn't show any duplicates but I'm hesitant to say that proves anything as the only time I can get the errors to occur is NCrunch's automated test process. Manually triggered tests work fine and those are the only ones I can do in debug mode.
Remco;2142 wrote:Are you doing any manual loading of assemblies into your application domain through the use of Assembly.LoadFrom? Or are you using any frameworks (such as an IOC container) that may do this?
Not on purpose! I've got a fairly standard back-end library and some web-services which I've added to a VS Solution along with the unit tests. I've thusfar allowed VS to manage all of my assembles and whatnot so if I'm doing anything of the sort it's certainly not intentional.
Remco;2142 wrote:It also looks as though you have a DLL file somehow being copied to your MSTest 'Out' directory. NCrunch normally won't do this, so I suspect something else is also going on here. Basically, we need to ensure that the PortalBackend.dll file in the MSTest 'Out' directory does not get loaded into the test application domain.
Will NCrunch do that if it's configured to copy referenced assemblies into the workspace? NCrunch won't build the solution without that flag so I had to set it. Otherwise I've left the default configuration alone.
I do have a Post-build event on the project that generates PortalBackend.dll, but NCrunch says it's configured not to run those.
Thanks in advance for your help!