Sdk: Native DLL not found with dotnet cli win-x64 while testing with xunit targeting net451

Created on 17 May 2016  路  15Comments  路  Source: dotnet/sdk

Steps to reproduce

project.json:

{
  "version": "1.0.0-*",
  "buildOptions": {
    "emitEntryPoint": true
  },
  "dependencies": {
    "xunit": "2.1.0-*",
    "dotnet-test-xunit": {
      "version": "1.0.0-rc2-*",
      "target": "package"
    },
    "Microsoft.NETCore.Platforms": "1.0.1-rc2-*"
  },
  "frameworks": {
    "net451": {
    }
  },
  "testRunner": "xunit"
}

Program.cs:

using System;

namespace ConsoleApplication
{
    public class Program
    {
        public static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
        }
    }
}

Commands:

dotnet restore
dotnet test

Expected behavior

Working test run, as with .NET Core 1.0 RC2:

xUnit.net .NET CLI test runner (64-bit win10-x64)
  Discovering: test-xunit
  Discovered:  test-xunit
=== TEST EXECUTION SUMMARY ===
   test-xunit.dll  Total: 0
SUMMARY: Total: 1 targets, Passed: 1, Failed: 0.

Actual behavior

xUnit.net .NET CLI test runner (32-bit win10-x86)
System.DllNotFoundException: Die DLL "Microsoft.DiaSymReader.Native.x86.dll": Das angegebene Modul wurde nicht gefunden. (Ausnahme von HRESULT: 0x8007007E) kann nicht geladen werden.
SUMMARY: Total: 1 targets, Passed: 0, Failed: 1.

The error message says, that the file Microsoft.DiaSymReader.Native.x86.dll could not be found.

The full build output is stored in .\Debug\net451\win7-x64, which only contains a Microsoft.DiaSymReader.Native.amd64.dll.

When I specify an explicit -r win7-x86, the output gets stored in .\Debug\net451\win7-x86, but - according to the Process Monitor - gets searched for in the .\Debug\net451\win7-x64 folder.

Using the x86 version of dotnet-cli works as expected for both net451 and netcoreapp1.0.

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0-preview1-002702)

Product Information:
 Version:     1.0.0-preview1-002702
 Commit Sha:  6cde21225e

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.10586
 OS Platform: Windows
 RID:         win10-x64
Area-External

Most helpful comment

Followed the recommendations on the xunit issue and was able to get things working again.

All 15 comments

I've got exactly the same behavior here !
Got my tests running with framework .NETCoreApp,Version=v1.0, but it's failed with .NETFramework,Version=v4.5.1 or v4.6

+1 same behavior with 4.6

I have the same problem. Explicitly specifiying where the compiled binaries are works for me.

> dotnet test -> Fails as described above trying to locate Microsoft.DiaSymReader.Native.x86.dll, banner is xUnit.net .NET CLI test runner (32-bit win10-x86)
> dotnet test -r win10-x86 -o bin\Debug\net46\win10-x86 -> Works :fireworks: properly and runs all tests

Setting the runtime seems to have the effect of copying the required DLLs to the output directory.

As well setting any other runtime (i.e. win10-x64) seems to have no effect on the runner -always uses win10-x86 in my case-.

That project.json fails the same for me too:

xUnit.net .NET CLI test runner (32-bit win7-x86)
System.DllNotFoundException: Unable to load DLL 'Microsoft.DiaSymReader.Native.x86.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
SUMMARY: Total: 1 targets, Passed: 0, Failed: 1.

I don't have a bin\Debugnet451\win7-x86 folder, only bin\Debugnet451\win7-x64. Passing either win7-x86 or win7-x64 with the -r and -o flags doesn't seem to make any difference to the output. Using a framework of "net46" instead of "net451" fails in the same way.

+1 same error with framework net46
When I build the class library, the Discovering tests display: 'test-xunit' returned '1'.

same here

:+1:

I noticed that as a temporary fix adding C:\Program Files\dotnet\sdk\1.0.0-preview1-002702\runtimes\win-x86\native to Env:Path helps.

:+1:

馃憤

:+1:

This is an issue with the xunit runner. See https://github.com/xunit/xunit/issues/843

Followed the recommendations on the xunit issue and was able to get things working again.

I'm closing this issue, because it's not related to dotnet/cli. Updating xunit to rc3 works. The myget gallery for xunit where s/o can download the RC3: https://myget.org/gallery/xunit

Was this page helpful?
0 / 5 - 0 ratings