FileNotFoundException when running unit test calling COM

I am trying to Resharper to run some NUnit unit tests.  Some of the tests make a call to a COM component via the .Net wrapper.  In the straightforward case, where the wrapper is created and in turn creates the underlying COM component, this appears to work fine.  However, there are methods in the COM component which will try to CoCreateInstance another COM component.  In this case, the test fails with the following error:

System.IO.FileNotFoundException : The specified module could not be found. (Exception from HRESULT: 0x8007007E)

The COM component is registered and does work to some degree as described above.  I think Resharper is looking for the actual COM DLL file, but am not exactly sure.

Additional note: in the Resharper options, it is specified to Run tests from: Project output folder, which is where the COM DLL and the .Net Interop DLL reside.

5 comments

Hello Jimmy,

Are you able to successfully run that test using the original NUnit GUI runner?
Thank you!

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

I am trying to Resharper to run some NUnit unit tests.  Some of the
tests make a call to a COM component via the .Net wrapper.  In the
straightforward case, where the wrapper is created and in turn creates
the underlying COM component, this appears to work fine.  However,
there are methods in the COM component which will try to
CoCreateInstance another COM component.  In this case, the test fails
with the following error:

System.IO.FileNotFoundException : The specified module could not be
found. (Exception from HRESULT: 0x8007007E)

The COM component is registered and does work to some degree as
described above.  I think Resharper is looking for the actual COM DLL
file, but am not exactly sure.

Additional note: in the Resharper options, it is specified to Run
tests from: Project output folder, which is where the COM DLL and the
.Net Interop DLL reside.

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



0

Hi Andrey, after some further testing, it appears that the NUnit GUI runner exhibits a similar behavior.  However, I was able to resolve it by moving the NUnit GUI exe into my working directory and running it from there.  I would rather not have to resort to using the NUnit GUI though, as we want to continually execute from within Visual Studio.

0

Is anyone else trying to run unit tests that make use of COM components?  It seems like this scenario should be fairly common and there's probably a correct way to approach this.  I just haven't come across it yet.

0

I have just installed Resharper 6 and am now getting this problem.

The project is a x86 project with a x86 COM dependency.  Fortunatelly its an open source project so easy for you resharperers to reproduce:
https://github.com/gatapia/jish

Note: Just tried a non COM project and everything works as expected.

bug.jpg

Guido

0

I just re-added the nunit assembly into my project and removed nunit.core.dll and everything is now working?  Strange...

Thanks anyways

0

Please sign in to leave a comment.