Unable to load DLL 'Microsoft.Quantum.Simulator.Runtime' when running Q# test project #1145
Description
Describe the bug
The following error message is produced when running a Q# test project on build 0.28.263081:
System.DllNotFoundException : Unable to load DLL 'Microsoft.Simulator.Runtime' or one of its dependencies: A dynamic link library (DLL) initialization routine failed. (0x8007045A)
To Reproduce
Create new default test project:
<Project Sdk="Microsoft.Quantum.Sdk/0.28.263081">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Quantum.Xunit" Version="0.28.263081" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
</ItemGroup>
</Project>
Run dotnet test
from the command line or run the test from the VS test explorer.
Expected behavior
Test should run successfully.
Actual behavior
Project builds fine but throws runtime error above.
System information
-
OS: Windows 22H2 19045.2965, x64-based processor
-
.NET Core Version: 6.0.408
Additional context
I suspect that the problem is related to libomp140.x86_64.dll
as in #897. Any help with a workaround would be greatly appreciated.
Note that my ~\.nuget\packages\microsoft.quantum.simulators\0.28.263081\runtimes\win-x64\native
contains Microsoft.Quantum.Simulator.Runtime.dll
and libomp140.x86_64.dll
.
Edit: Confirmed same behavior on Ubuntu 18.04. Also with the default console application.
Edit 2: Latest SDK version that does not give this error on the Windows VM is 0.21.2112180703; this needs the .NET 3.1 runtime installed to build though.