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

1 Answer 362 Views
Continuous Integration Integrations
Sandro
Top achievements
Rank 1
Iron
Sandro asked on 10 Oct 2022, 02:16 PM | edited on 10 Oct 2022, 02:17 PM

Hi there

We are facing an issue on our on-premise Azure DevOps build agents, where we have JustMock installed, since the version 2.0.13 from last Thursday 6th Oct. 2022 but also with the today's version 2.0.14.

Exception:

[xUnit.net 00:00:02.79]       Telerik.JustMock.Core.ElevatedMockingException : Cannot mock 'System.DateTime'. The profiler must be enabled to mock, arrange or execute the specified target.
[xUnit.net 00:00:02.79]       Stack Trace:
[xUnit.net 00:00:02.79]            at Telerik.JustMock.Core.ProfilerInterceptor.ThrowElevatedMockingException(MemberInfo member)
[xUnit.net 00:00:02.79]            at Telerik.JustMock.Core.MocksRepository.InterceptStatics(Type type, MockCreationSettings settings, Boolean mockStaticConstructor)
[xUnit.net 00:00:02.79]            at Telerik.JustMock.Core.CallPatternCreator.FromExpression(MocksRepository repository, Expression expr)
[xUnit.net 00:00:02.79]            at Telerik.JustMock.Core.MocksRepository.Arrange[TMethodMock](Expression expression, Func`1 methodMockFactory)
[xUnit.net 00:00:02.79]            at Telerik.JustMock.Mock.<>c__DisplayClass1_0`1.<Arrange>b__0()
[xUnit.net 00:00:02.79]            at Telerik.JustMock.Core.ProfilerInterceptor.GuardInternal[T](Func`1 guardedAction)
[xUnit.net 00:00:02.79]            at Telerik.JustMock.Mock.Arrange[TResult](Expression`1 expression)

We are using the task JustMockVSTest@2 and have no additional configurations for the JustMock Profiler set, like described in your integration guide: https://docs.telerik.com/devtools/justmock/integration/continuous-integration/tfs-azure/azure-devops

On the system there is the Profiler installed under "C:\Program Files (x86)\Progress\Telerik JustMock\Libraries\CodeWeaver\<bitness>\Telerik.CodeWeaver.Profiler.dll"

We see that the task is initializing the path to the Profiler (32bit and 64bit) to the $(System.DefaultWorkingDirectory) like:

Starting: VsTest - testAssemblies
==============================================================================
Task         : Telerik JustMock VSTest v.2
Description  : Use VSTest runner to run tests that are mocked with Telerik JustMock.
Version      : 2.7.1
Author       : Telerik
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/test/vstest
==============================================================================
SystemVssConnection exists true
Setting up JustMock
======================================================
The specified path to 32 bit JustMock profiler is: D:\azagent\<organisation>\A1\_work\<build>\s
The specified path to 64 bit JustMock profiler is: D:\azagent\<organisation>\A1\_work\<build>\s
SystemVssConnection exists true
Running tests using vstest.console.exe runner.
======================================================

Before the Profiler was initialized with null:

Starting: VsTest - testAssemblies
==============================================================================
Task         : Telerik JustMock VSTest v.2
Description  : Use VSTest runner to run tests that are mocked with Telerik JustMock.
Version      : 2.6.1
Author       : Telerik
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/test/vstest
==============================================================================
SystemVssConnection exists true
SystemVssConnection exists true
Setting up JustMock
======================================================
The specified path to 32 bit JustMock profiler is: null
The specified path to 64 bit JustMock profiler is: null
SystemVssConnection exists true
Running tests using vstest.console.exe runner.
======================================================

Is there anything we have to configure, like the absolute/relative path to the Profiler? Or is this a bug within the new release?

Thanks for your help.

Cheers

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Ivo
Telerik team
answered on 11 Oct 2022, 10:05 AM

Hello Sandro,

The issue you are facing is a regression in version 2.0.13 and it occurs when the profiler paths in the task configuration paths are empty, but later the actual values are assigned by default with the agent build directory. The issue should no longer be present in the newly released version 2.0.14. Please verify that the pipeline is using exactly this version, sometimes it takes a few runs to be triggered in order to be updated properly. If this is the case we could continue researching the possible reasons for this failure.

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.

Sandro
Top achievements
Rank 1
Iron
commented on 11 Oct 2022, 10:59 AM

Hi Ivo

Thank you for your answer. I just checked it and can confirm that this is no more an issue.

We tried it already yesterday with the version 2.0.14 but as you stated it obviously took a few runs to take the right version.

Cheers

Ivo
Telerik team
commented on 11 Oct 2022, 01:55 PM

Excellent, I am happy to hear that issue is now resolved. Wish you all the best!
Tags
Continuous Integration Integrations
Asked by
Sandro
Top achievements
Rank 1
Iron
Answers by
Ivo
Telerik team
Share this question
or