System.IO.FileNotFoundException exception when running unit test

Hello,

In build 1529 (and seemingly, after build 1288 (with note 'Contains Testing SpeedUp'), I and other users I work with get an error dialog after starting up a unit test:

'System.IO.FileNotFoundException occurred
Could not load file or assembly 'C:\Program Files\JetBrains\ReSharper\v5.0\Bin\log4net.dll' or one of its dependencies. The system cannot find the file specified.'

It is not alway this particular dll that can't be found, but when this error occurs, it is always attempting to find a dll in the ReSharper Bin directory.

Regards,

Richard Beauchamp

9 comments

A little more information:

1. It only occurs while Debugging, not Running.

2. Here is the stack trace:

   at System.Reflection.AssemblyName.nGetFileInformation(String s)
   at System.Reflection.AssemblyName.GetAssemblyName(String assemblyFile)
   at JetBrains.ReSharper.TaskRunnerFramework.AssemblyLoader.ResolveAssemblyFileByName(String name, String fullName) in c:\Agent\work\cc29ccea5bf569df\src\TaskRunnerFramework\src\AssemblyLoader.cs:line 177

0

And here is the 'Fusion Log':

=== Pre-bind state information ===
LOG: User = RICHARD\rbeauchamp
LOG: Where-ref bind. Location = C:\Program Files\JetBrains\ReSharper\v5.0\Bin\log4net.exe
LOG: Appbase = file:///C:/build/DomainObjects/Debug/Test
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This is an inspection only bind.
LOG: Using application configuration file: C:\build\DomainObjects\Debug\Test\DomainObjects.Test.dll.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Attempting download of new URL file:///C:/Program Files/JetBrains/ReSharper/v5.0/Bin/log4net.exe.

0

OK. I have some more information about this:

The exceptions only appear when Debug -> Exceptions... -> Thrown is enabled. And the exceptions have something to do with static initializers being invoked.

If I just continue past these initialization exceptions, the unit test does execute.

0

Hello,

This is coming from inside the NUnit original DLLs, as they seem to have
an optional component that causes exceptions when missing. This exception
started happening when we switched into using standard NUnit test runner
DLLs instead of our own NUnit-compatible implementation (used in earlier
versions due to licensing issues).


Serge Baltic
JetBrains, Inc — http://www.jetbrains.com
“Develop with pleasure!”


0

Hi Serge,

Thanks for the explanation.

Any work-arounds that you know of or is your team working on a fix? Currently I have to click through 6-7 exceptions before my unit test actually starts running...

Best regards,

Richard

0

Hello,

Any work-arounds that you know of or is your team working on a fix?
Currently I have to click through 6-7 exceptions before my unit test
actually starts running...


A quick guess...
1) Turn off breaking debugger on first-chance exceptions (you'll still see
"second-chance" exceptions and their stack traces in the test runner results).
2) Install a full copy of NUnit and set up R# options for the runner to use
your NUnit instead of the bundled copy. If the full NUnit installation includes
log4net and other optional things, the exception should not happen.


Serge Baltic
JetBrains, Inc — http://www.jetbrains.com
“Develop with pleasure!”


0

A quick guess...
1) Turn off breaking debugger on first-chance exceptions (you'll still see
"second-chance" exceptions and their stack traces in the test runner results).


Yes, this avoids the exceptions. (But then first-chance exceptions are off for your unit tests).


2) Install a full copy of NUnit and set up R# options for the runner to use
your NUnit instead of the bundled copy. If the full NUnit installation includes
log4net and other optional things, the exception should not happen.



First-chance exceptions are still thrown in this scenario. I installed a full copy of NUnit 2.5.2 which includes log4net, configured Resharper to run tests with the specified NUnit installation "C:\Program Files\NUnit 2.5.2\bin\net-2.0". No difference from using the bundled copy.

Richard Beauchamp
0

A quick guess...
> 1) Turn off breaking debugger on first-chance exceptions (you'll still 
> see
> "second-chance" exceptions and their stack traces in the test runner 
> results).

>

Yes, this avoids the exceptions. (But then first-chance exceptions are 
off for your unit tests).

>
>

2) Install a full copy of 
> NUnit and set up R# options for the runner to use
> your NUnit instead of the bundled copy. If the full NUnit installation 
> includes
> log4net and other optional things, the exception should not 
> happen.

>

First-chance exceptions are still thrown in this scenario. I installed a 
full copy of NUnit 2.5.2 which includes log4net, configured Resharper to 
run tests with the specified NUnit installation "C:\Program Files\NUnit 
2.5.2\bin\net-2.0". No difference from using the bundled copy.

>

Richard Beauchamp

>

---
Original message URL: 
http://www.jetbrains.net/devnet/message/5251782#5251782


You can only disable the break on a thrown exception of the exception that 
gives you problems (In this case: System.IO.FileNotFoundException).
Click on the + to open the exception-type-tree in the exceptions dialog 
and pick you exceptiontypes.
That way it will only give you troubles if you are debugging FileNotFound 
unittests.

Good luck debugging.

Arnold Nelisse

0

You can only disable the break on a thrown exception of the exception...


Yes, that seems like a better work-around.

Thanks,

Richard

0

Please sign in to leave a comment.