NUnit v3.0 console error message "Unable to load one or more of the requested types"

1,001 views
Skip to first unread message

constructor

unread,
Mar 16, 2015, 11:28:00 AM3/16/15
to nunit-...@googlegroups.com
Hi,

I try to execute NUnit v3.0 console on my test project (works with NUnit v2.x), but next error message shown (see below). Also attached file TestResult.xml.
I executed tests from NUnit-3.0 binary folder and from my test folder: same result.

Please, could you help me to understand the issue?

thank you,
Igor.

NUnit Console Runner 3.0.5509
Copyright (C) 2014 Charlie Poole

Test Files:
    <working folder>
\UnitTests.dll

Runtime Environment
   OS Version: Microsoft Windows NT 6.1.7601 Service Pack 1
  CLR Version: 4.0.30319.34209

Options
    ProcessModel: Default    DomainUsage: Default
    Execution Runtime: Not Specified
    Work Directory: D:\CompanySW\Tools\nunit\NUnit-3.0.0-alpha-5b\bin
    Internal Trace: Off


Test Run Summary
    Overall result: Failed
   Tests run: 0, Passed: 0, Errors: 0, Failures: 0, Inconclusive: 0
     Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0
  Start time: 2015-03-16 15:17:45Z
    End time: 2015-03-16 15:17:46Z
    Duration: 0.238 seconds

Unable to load one or more of the requested types. Retrieve the LoaderExceptions
 property for more information.

Errors and Failures

1) Invalid : <working folder>\UnitTests.dll
Unable to load one or more of the requested types. Retrieve the LoaderExceptions
 property for more information.

Results (nunit3) saved as TestResult.xml

D:\CompanySW\Tools\nunit\NUnit-3.0.0-alpha-5b\bin>pause
Press any key to continue . . .

TestResult.xml

Charlie Poole

unread,
Mar 16, 2015, 12:12:59 PM3/16/15
to NUnit-Discuss
There isn't enough info to help tell where the problem lies - it would
require debugging NUnit to find it.

That said, the error looks familiar to me and I suspect it may be
fixed in the current source. Here are some options:

* If you are able to download and build the latest source, please
let us know if the problem persists.

* Provide an extremely simple, shareable example that shows this
behavior so we can debug it.

* Wait a bit for the next binary release, which will be the first
beta. My guess is that we'll release it in about 10 days.

Charlie
> --
> You received this message because you are subscribed to the Google Groups
> "NUnit-Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nunit-discus...@googlegroups.com.
> To post to this group, send email to nunit-...@googlegroups.com.
> Visit this group at http://groups.google.com/group/nunit-discuss.
> For more options, visit https://groups.google.com/d/optout.

Rob Prouse

unread,
Mar 16, 2015, 12:19:10 PM3/16/15
to nunit-...@googlegroups.com
As Charlie said, this is a tough one to diagnose without more information. It is just a stab in the dark, but it could be a shadow copy issue. Do you have any native assemblies that are referenced/pinvoked from your managed code? Any plugins that are loaded dynamically?
--

Rob Prouse

 

I welcome VSRE emails. Learn more at http://vsre.info/

constructor

unread,
Mar 18, 2015, 4:45:24 AM3/18/15
to nunit-...@googlegroups.com
Hi,

Yes, I have native assemblies.
Also I tried to debug the issue.
Please, could you help me? How to execute program "nunit-console" without any "agents" and "domains" for debug purposes. I cannot catch a real reason of the issue.
When I run "nunit-console" with my tests dll under VS2013 I receive the same error message and cannot catch a real place of exception.

thank you,
Igor.

constructor

unread,
Mar 18, 2015, 5:00:22 AM3/18/15
to nunit-...@googlegroups.com
ok, parameters " --domain=None --process=Single" allows me to debug the issue.
Seems, console help shows incorrect default values.

constructor

unread,
Mar 18, 2015, 6:39:47 AM3/18/15
to nunit-...@googlegroups.com
Report:

1. Failed in file <root>\src\NUnitFramework\framework\Api\DefaultTestAssemblyBuilder.cs in method GetCandidateFixtureTypes(), line 190 "IList types = assembly.GetTypes();".

2. My binary folder has next structure:
<root>
<root>\CompilationResults                  - test binaries only
<root>\CompilationResults\Common    - tested binaries

3. Test project has configuration file:
<?xml version="1.0"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="Common;"/>
    </assemblyBinding>
  </runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>

4. Fusion log:
According to fusion log, dotnet framework doesn't try to search binaries into folder \Common.

5. nunit v2.x works on the test case.

6. by the way, when I set parameters "--domain=None --process=Single" for other working test project, nunit stops to execute tests, because it works with empty fixture list.

thank you,
Igor.

Charlie Poole

unread,
Mar 18, 2015, 9:27:37 AM3/18/15
to NUnit-Discuss
The current version of the console help doesn't show the defaults at
all - it probably should.

The traditional NUnit default has been "Separate" for many years. It
has been changed to "Multiple" in the latest code.

You are correct that --process=Single is the easiest way to debug,
since your tests are run in the same process as nunit-console.

Charlie

Charlie Poole

unread,
Mar 18, 2015, 9:30:39 AM3/18/15
to NUnit-Discuss
What is the name of your test project configuration file and whre is it located?

constructor

unread,
Mar 18, 2015, 10:22:43 AM3/18/15
to nunit-...@googlegroups.com
name of the test project: UnitTests.dll
name of config file: UnitTests.dll.config 
files UnitTests.dll and UnitTests.dll.config placed in the same folder <root>\CompilationResults
tested binaries files placed into <root>\CompilationResults\Common
I cannot publish the code.
If it's necessary I can try to reproduce the issue on new test project.

configuration file UnitTests.dll.config content

<?xml version="1.0"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="Common;"/>
    </assemblyBinding>
  </runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>


Charlie Poole

unread,
Mar 18, 2015, 10:33:43 AM3/18/15
to NUnit-Discuss
OK... you have it set up correctly.

Ah... I just thought of something... your use of --domain=None defeats
the config: since no AppDomain is created, no config can be set for
it. Domain=none is for use in extremely limited circumstances, such as
code which can only execute in the primary appdomain. Do you really
need it?

Charlie

constructor

unread,
Mar 19, 2015, 3:22:33 AM3/19/15
to nunit-...@googlegroups.com
I set "--domain=None" for debug purposes only.
Error shown without parameter "--domain=None" too.

I don't use the option ("--domain=None") in production.

thank you,
Igor.
Reply all
Reply to author
Forward
0 new messages