"The profiler must be enabled to mock, arrange or execute the specified target."

2 Answers 748 Views
General Discussions
Chris Vrolijk
Top achievements
Rank 1
Iron
Chris Vrolijk asked on 26 Jan 2022, 02:26 PM

Unfortunately my JustMock does not work anymore. I get this exception:

  Message: 
    Test method ActuIT.Futurama.Test.TestEdit.EditorTest threw exception: 
    Telerik.JustMock.Core.ElevatedMockingException: Cannot mock 'System.IO.File'. The profiler must be enabled to mock, arrange or execute the specified target.

  Stack Trace: 
    ProfilerInterceptor.ThrowElevatedMockingException(MemberInfo member)
    MocksRepository.InterceptStatics(Type type, MockCreationSettings settings, Boolean mockStaticConstructor)
    <>c__DisplayClass69_0.<SetupStatic>b__0()
    ProfilerInterceptor.GuardInternal(Action guardedAction)
    Mock.SetupStatic(Type staticType, Behavior behavior)
    TestEdit.PerformTest(TestInput testInput, String& logFile) line 1413
    TestEdit.PerformTest(String testFile, String& logFile) line 1400
    TestEdit.EditorTest() line 360

Some background:

- I started of with VS2019 version 16.10.4 and JustMock version 2019.2.620.1

- Profiler is enabled in Extensions->JustMock

- tried to reinstall -> no effect

- upgraded VS2019 to 16.11.9 -> no effect

- upgraded to JustMock 2022.1.119.1 -> no effect

- Above is just a sample, all of my unit tests that use JustMock fail

- I checked a colleague and he had exactly the same problem

Any setting/config I might have missed?

Regards,

Dirk

 

 

 

 

 

 

2 Answers, 1 is accepted

Sort by
1
Ivo
Telerik team
answered on 28 Jan 2022, 10:22 AM

Hello Chris,

It is a kind strange, indeed. You are saying "anymore", it sounds like: "it has worked for some time and stopped at some point", is it right? I would recommend making a few simple tests in order to discover the root cause:

  • Inside Visual Studio - disable JustMock extension and restart the IDE, open your test project and configure run settings using the attached file, take a look at the desired option

  • Outside Visual Studio - try to run the test at the command line, here is a documentation article that will guide you in this exercise

Please let me know the outcome of the tests, based on them we will decide how to continue further.

Regards,
Ivo
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

0
Chris Vrolijk
Top achievements
Rank 1
Iron
answered on 31 Jan 2022, 10:17 AM

Solved! Using 1st solution, did not (need to) try second one.

Thank you!

Tags
General Discussions
Asked by
Chris Vrolijk
Top achievements
Rank 1
Iron
Answers by
Ivo
Telerik team
Chris Vrolijk
Top achievements
Rank 1
Iron
Share this question
or