Hi there
We are trying to move our current build agents from Windows to Linux (Ubuntu 20.04) for all our dotnet6.0 applications and trying to integrate the JustMock Profiler on this machine because we depend on it in several tests.
Therefore, we followed your integration article "JustMock Integration on Linux".
We have copied the Profiler binaries to the build agent and referencing it through the environment variable:
root@8d248b92b005:/azp/Backend# printenv | grep 'CORE\|JUST' CORECLR_PROFILER_PATH=/opt/TelerikJustMock/JustMock_2022_1_223_1_Dev/Libraries/CodeWeaver/64/libTelerik.CodeWeaver.Profiler.so CORECLR_PROFILER={B7ABE522-A68F-44F2-925B-81E7488E9EC0} JUSTMOCK_INSTANCE=1 CORECLR_ENABLE_PROFILING=1
The csproj definition for referencing the JustMock library looks (at the moment) like the following:
...
<ItemGroup>
<Reference Include="Telerik.JustMock">
<HintPath Condition="Exists('C:\Program Files (x86)\Progress\Telerik JustMock\Libraries\netcoreapp2.0\Telerik.JustMock.dll')">C:\Program Files (x86)\Progress\Telerik JustMock\Libraries\netcoreapp2.0\Telerik.JustMock.dll</HintPath>
<HintPath Condition="Exists('/opt/TelerikJustMock/JustMock_2022_1_223_1_Dev/Libraries/netcoreapp2.0/Telerik.JustMock.dll')">/opt/TelerikJustMock/JustMock_2022_1_223_1_Dev/Libraries/netcoreapp2.0/Telerik.JustMock.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
...
In the tests we are calling the following method to check for the Profiler to be enabled:
public class Test_JustMockProfiler_Enabled
{
[Fact]
public void ProfilerMustBeEnabled()
{
Mock.IsProfilerEnabled.Should().BeTrue();
}
}
Then running the tests with the 'dotnet test' command:
dotnet test /path/to/Tests.dll --no-build --no-restore -l:trx --results-directory ./TestResults/
But still we get the following error:
Error Message: Expected Mock.IsProfilerEnabled to be true, but found False.
Installed dotnet:
root@8d248b92b005:/azp/Backend# dotnet --info .NET SDK (reflecting any global.json): Version: 6.0.402 Commit: 6862418796 Runtime Environment: OS Name: ubuntu OS Version: 20.04 OS Platform: Linux RID: ubuntu.20.04-x64 Base Path: /usr/share/dotnet/sdk/6.0.402/ global.json file: Not found Host: Version: 6.0.10 Architecture: x64 Commit: 5a400c212a .NET SDKs installed: 6.0.402 [/usr/share/dotnet/sdk] .NET runtimes installed: Microsoft.AspNetCore.App 6.0.10 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.10 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Is there anything we are missing or doing wrong?
How do we properly enable the Profile on Linux to run in 'dotnet test'?
Thanks for your help in advance, cheers.