AccessViolationException is thrown while debugging the test

0 votes

Hi,

When I tried to debug the unit test code, I am getting below exception:

An exception of type 'System.AccessViolationException' occurred in TypeMock.dll but was not handled in user code
 
Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
 
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
 
Here is the part of test method I am using:
 
[TestMethod()]
public void EditDocumentTest()
{
string documentId = "5888781d253ec3000e4d841e";
JWTModel jwtModel = new JWTModel()
{
AccessToken = "testToken",
Email = "someone@test.com",
UserId = "5138-081d-253e-d3010esd841e"
};
 
//Isolate Decode
var jWTProvider = Isolate.Fake.AllInstances<JWTProvider>();
Isolate.WhenCalled(() => jWTProvider.Decode()).WillReturn(jwtModel);
}

I am getting AccessViolationException in
var jWTProvider = Isolate.Fake.AllInstances<JWTProvider>();

I am using Typemock Isolator 8.5.2.29. Nuget has version 8.5.2.110 but the Isolator version from download url is 8.5.2.29 only.

I have also verified that I have only 8.5.2.29 version in GAC. Also the same version I am using in my project from Nuget. I am having Windows 7 x64 with Visual Studio 2015 Enterprise.

Let me know how to resolve the issue.

Thanks

asked Mar 22 by sri79 (120 points)

1 Answer

0 votes
Hi

First of all never use the higher nuget versions. Use or the same version as installed or lower.

Remove your nuget package, download the appropriate one and try again.

Tell me if it helps.
answered Apr 3 by eva (1,280 points)
...