Skip to content

Feature request: Print LoaderExceptions when fixture loading fails #1238

@espenalb

Description

@espenalb

Hi.

I have a problem in my test fixture - when trying to run it with the console runner, I get

Agent process 13984 starting
Running under version 4.0.30319.42000, Net 4.5
Agent process 13984 exiting

Errors and Failures

1) Invalid : c:\PathToMy\Tests.dll
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

Obviously this error message is not very helpful - the real value would be to print the contents of the LoaderExceptions.

So I cloned the nunit code and fired up the the console runner - only to realize that the problem of course happens inside the nunit agent. Setting the --debug-agent flag did not help - the "c:\program files..\nunit3-agent" was loaded. I then realized that I had to explicitly compile the agent (so that it exists in the same folder as my debug console). This was of course all natural and intentional, but not obvious on first go. Just realized that the command to get all the debug dll's compiled is build.cmd build.cake Default Debug 😄

Further investigation showed that if I explicitly set the framework: --framework=net-4.5 - I get a nice BadImageFormatException (Because that was the error).

However - if I do not explicitly specify the framework, I get the generic, not very helpfull error message.
Ideally NUnit should print the content of the loader exception directly...

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions