Unit Test Runner Fails on a .Net 2.0 Framework project

The unit tests run in visual studio 2008 but fail in 2010 with following
error

System.BadImageFormatException: Could not load file or assembly
'DeployLX.Licensing.v3.DLL' or one of its dependencies. Invalid access to
memory

I think your loading the dll's for the unit test runner with the framework
4.0 and then the dll crashes the runtime.
The dll has anti obfuscation 'features' implemented that seem to work only
with the 2.0 framework but not with the .net 4.0 framework.
Is there a workaround for this except not using visual studio 2010 with the
resharper unit test explorer?

Sincerly Thomas Stocker


2 comments

Hello Thomas,

Create or open for edit a file in ReSharper installation folder, JetBrains.ReSharper.TaskRunner.exe.config
Make it as follows, and fix the requiredRuntime to your preference:

Sincerely, Ilya Ryzhenkov JetBrains, Inc http://www.jetbrains.com "Develop with pleasure!" TS> The unit tests run in visual studio 2008 but fail in 2010 with TS> following error TS> TS> System.BadImageFormatException: Could not load file or assembly TS> 'DeployLX.Licensing.v3.DLL' or one of its dependencies. Invalid TS> access to memory TS> TS> I think your loading the dll's for the unit test runner with the TS> framework TS> 4.0 and then the dll crashes the runtime. TS> The dll has anti obfuscation 'features' implemented that seem to TS> work only TS> with the 2.0 framework but not with the .net 4.0 framework. TS> Is there a workaround for this except not using visual studio 2010 TS> with the TS> resharper unit test explorer? TS> Sincerly Thomas Stocker TS>]]>


0

I found out the problem with the following unit Test ;) , the Test runner
runs my dll's with the framework 4.0 instead of 2.0 which cannot work.
Because I said that the Project should target the 2.0 Framework.



typeof (string).Assembly.ImageRuntimeVersion is version "v4.0.20506" should
be something like "v2.0.*"


]]> isn't the problem






public void TestFramework()

{

Assert.AreNotEqual("v4.0.20506", typeof
(string).Assembly.ImageRuntimeVersion);

}


"Ilya Ryzhenkov" <orangy@jetbrains.com> wrote in message
news:76a2bd0b1863df8cbd2eeb0da1a29@news.intellij.net...

Hello Thomas,

>

Create or open for edit a file in ReSharper installation folder,
JetBrains.ReSharper.TaskRunner.exe.config
Make it as follows, and fix the requiredRuntime to your preference:

>

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<!-- Don't kill application on first uncaught exception. -->
<legacyUnhandledExceptionPolicy enabled="1" />
</runtime>
<startup>
<requiredRuntime version="v4.0.20506"/>
</startup>
</configuration>

>

Sincerely,
Ilya Ryzhenkov

>

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

>
>

TS> The unit tests run in visual studio 2008 but fail in 2010 with
TS> following error
TS> TS> System.BadImageFormatException: Could not load file or assembly
TS> 'DeployLX.Licensing.v3.DLL' or one of its dependencies. Invalid
TS> access to memory
TS> TS> I think your loading the dll's for the unit test runner with the
TS> framework
TS> 4.0 and then the dll crashes the runtime.
TS> The dll has anti obfuscation 'features' implemented that seem to
TS> work only
TS> with the 2.0 framework but not with the .net 4.0 framework.
TS> Is there a workaround for this except not using visual studio 2010
TS> with the
TS> resharper unit test explorer?
TS> Sincerly Thomas Stocker
TS>



0

Please sign in to leave a comment.