Build/Test Issues

AccessViolationException on creation of application domain

Started by springjazzy on 6,183 views

Could you please verify that this simple test crashes NCrunch:


using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace UnitTestProject1
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            var _appDomain = AppDomain.CreateDomain(string.Format("App_{0}", Guid.NewGuid()));
        }
    }
}


If I choose to build test project as 4.0 .NET Framework then everything works fine, but when I choose 4.5.2. .NET Framework then NCrunch keeps showing System.AccessViolationException. BTW MSTest runs this test without any problem.

I use latest NCrunch 3.3.0.6 with VS2013

Edited

Got it. That's because third party cryptographic library. Interestingly though, that I've marked method with HandleProcessCorruptedStateExceptionsAttribute and SecurityCriticalAttribute and still couldn't intercept it, which points that exception is thrown somewhere in NCrunch.

Edited

Hi, thanks for sharing this issue.

This code seems to run normally for me regardless of the target framework.

Do you have FIPS enabled on your system?

Does turning off the 'Instrument output assembly' setting for the projects involved make any difference?
>Do you have FIPS enabled on your system?
No. I use other crypto algorithms


>Does turning off the 'Instrument output assembly' setting for the projects involved make any difference?
No. No difference.

Do you experience this problem if you execute the same code under NUnit, using the NUnit console runner?

This looks to be a system related issue.
Don't know about NUnit. But if I run tests under Resharper test system (which suspiciously looks like NCrunch by the way) I also get AccessViolationException. The only way to pass test is run it under native MSTest VS runner.

I agree. It looks like issue related to that third party crypto library.

Edited

Post a reply

Log in to reply.