Configure useLegacyV2RuntimeActivationPolicy for test projects in VS 2010

In .NET 4, to load .NET 2 mixed-mode collections, you need to set useLegacyV2RuntimeActivationPolicy="true" to the app.config file launch item for the application project.

How can I install this (and this is necessary) for a test project? I get very strange behavior on a test node, but only for tests that use CLR 2 mixed-mode assemblies directly, so I suspect this might be the culprit ...

Valid error accepted:

The UnitTestAdapter test adapter threw an exception when running the MyTest test. The exception was caused by the purpose of the call. Attempted to read or write protected memory. This often indicates that another memory is corrupted.

However, it does not appear as a test failure, but rather as an Error . A similar exception occurs in the unit test adapter, and not in my code.

+4
source share
1 answer

As far as I know, there is no way to set this option through the user interface. I'm not sure if this will be a supported scenario or not. It definitely seems like it should be. Could you find a connection error to track this problem?

At the same time, you can get around this by setting an option in the QTAgent32 application. This is a process that is actually used to run unit tests and is located in

C: \ Program Files (x86) \ Microsoft Visual Studio 10.0 \ Common7 \ IDE \ QTAgent32.exe

Yes, a very hacky solution, but I hope it unlocks you.

+2
source

Source: https://habr.com/ru/post/1301737/


All Articles