Assembly.GetType fails to resolve List`1[[MyModel]] in ReSharper plugin only

I have a R# plugin and a test project (not a R# test project, but a simple, plain unit-test project). In the code of the plugin I do some type resolution from serialized type information. On such type is a list of object from one of my model classes. The serialization of the type looks like this:

    "System.Collections.Generic.List`1[[Model.Foo, Model]], mscorlib"

I load this type (or, actually, Json.NET does) with the following calls:

    Assembly assembly = Assembly.LoadWithPartialName(assemblyName);
    Type type = assembly.GetType(typeName);

In my test project, when I run this code, everything works just fine. The assemblyName is "mscorlib" and the first line resolves the mscorlib assembly (as an instance of RuntimeAssembly). The typeName is "System.Collections.Generic.List`1[[Model.Foo, Model]]" and the call to GetType() resolves my type.

When I run the R# plugin, however, the GetType() call returns null. Till that line everything looks like when I execute from the test project. Both projects reference the "Model" assembly. When I try to resolve only the type "Model.Foo, Model" using the exact same mechanism, it works in the R# plugin and the test project both.

When I allow the GetType() call to throw exception, the FileNotFound exception (of course only thrown when running the R# plugin) tells me that the "Model" assembly cannot be found. The stacktrace contains a list of locations that were scannened. All these locations are below the VisualStudio installation directory.

As mentioned, the two lines above are actually part of Json.NET. Therefore, I cannot change them. However, I completely eliminated Json.NET while narrowing down this problem. Just the two lines above, with the respective string values of assemblyName and typeName suffice to reproduce the problem.

Can anybody tell me where this different behavior originates from? Or better: tell me how to solve this problem?

Thanks in advance!

Please sign in to leave a comment.