Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

An exception occurred while invoking executor 'executor://mstestadapter/v1': Type is not resolved for member

I'm getting a weird, well, I won't even call it an "error" per se. It is just that whenever I tell Visual Studio 2012 to "run all" of my unit tests (using MS Test) I get this weird message in the output window:

An exception occurred while invoking executor 'executor://mstestadapter/v1': Type is not resolved for member 'ASSEMBLY'

Thing is: I only get this error when running the unit tests, and it isn't an "exception", just that the tests don't run, don't ever even start. The program runs fine when deployed to IIS and I can manually debug the unit test and walk through it, and it works fine, so I have been unable to get any sort of detailed information.

It looks to me like my assembly, which is a 3rd party assembly, isn't being found by my test project while running its tests. Whenever I load these assemblies in the GAC however, it works fine.

Does anyone have any idea what might be causing this problem and what I could do to resolve it so that my unit tests will run without this 'error'?

This is a WCF web service connecting to a 3rd party database via their own exposed web service, which is what the 3rd party assemblies are.

EDIT:

According to the fusion logs, the unit test runner (VSTestConfig) is searching for those specific assemblies in its own executable folder, rather than the bin\debug folder, as I would expect. Has anyone else seen this issue, where, even though the assemblies are present in bin\debug, it isn't "searching" for them there?

Edit 2:

A year later... The environment I was working with when I got this error is long gone. I don't even really recall how the environment was setup. I am almost positive it had something to do with the way I had Visual Studio setup or something with my GAC... who knows. I doubt this question will ever be answered to any degree of finality, but by all means, if anyone ever gets this error and figures it out, let us know! :)

like image 217
m t Avatar asked Sep 04 '13 18:09

m t


1 Answers

I my case, this was a null reference behind the scenes.

You should investigate where the type is used where he is complaining about. If you find it you can debug it by inserting the following line's of code:

Debugger.Attach();
Debugger.Break();

To fix it, you can do a better test setup or use the following line to skip the code generating the error.

var processName = Process.GetCurrentProcess().ProcessName;
if(processName == "vstest.executionengine.x86"){ /*Do something else*/  } 

What I also suspected is [assembly: AssemblyCulture("")] because the test that failed depended on the Culture and I'm assuming the test runner runs without culture.

like image 128
Preben Huybrechts Avatar answered Oct 19 '22 23:10

Preben Huybrechts