chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
when trying to mock a call : Isolate.WhenCalled(() => content.ContentId).WillReturn(5);
i get System.UnauthorizedAccessException and stacktrace leads to typemock code : b2.a(String A_0)
asked by isasson1 (680 points)

5 Answers

0 votes
Hi Oren,

Can you send us the test code and the code of the class under test.
Also the full stacktrace would help.

Which version of Isolator do you use?
Are you using an appdomain with explicit permissions.
answered by alex (17k points)
0 votes
Stack trace :
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
System.Threading.Mutex.MutexTryCodeHelper.MutexTryCode(Object userData)
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
System.Threading.Mutex..ctor(Boolean initiallyOwned, String name, Boolean& createdNew, MutexSecurity mutexSecurity)
System.Threading.Mutex..ctor(Boolean initiallyOwned, String name, Boolean& createdNew)
System.Threading.Mutex..ctor(Boolean initiallyOwned, String name)
b2.a(String A_0)
ao.c(TraceData A_0)
TypeMock.MockManager.Init(Boolean collectAllCalls)
TypeMock.MockManager.a(String A_0, String A_1, Object A_2, Object A_3, Boolean A_4, Boolean A_5)
TypeMock.InternalMockManager.isMocked(Object that, String typeName, String methodName, Object methodParameters, Boolean isInjected, Boolean isIntercepted)
...StartFlow_MockTest() in C:Users......cs: line 0

Error: Test method ....StartFlow_MockTest threw exception:
System.UnauthorizedAccessException: Access to the path 'e37081e8-009f-4a43-854f-3c4223ce5181' is denied.

Version 6.0.4

for any code , both project specific or not
StackTrace fm = Isolate.Fake.Instance<StackTrace>();
Isolate.WhenCalled(() => fm.FrameCount).WillReturn(10);
answered by isasson1 (680 points)
0 votes

I've got some questions.

1) Which version of visual studio do you use?
2) What addins do you have in your visual studio?
3) Which runner do you use?
answered by alex (17k points)
0 votes
Hi Oren

This Patch should solve this issue: ... _mutex.msi

Please let us know if it helps.
answered by alex (17k points)
0 votes

Thanks for the feedback in the mail.
It's good to know that the patch solves the problem.

FYI, the patch is now included in version 7.0.9.
answered by NofarC (4k points)