Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An exception occurred while invoking executor: Could not load file or assembly System.Runtime.InteropServices.RuntimeInformation #365

Closed
ghost opened this issue Jul 20, 2017 · 5 comments

Comments

@ghost
Copy link

ghost commented Jul 20, 2017

Target framework: netcoreapp1.0
NUnit 3.7.1
NUnit3TestAdapter 3.8.0

New test library project with 2 simple test classes, attempting to run "dotnet test" from command line yields exception:

PS C:\gitroot\azure\aui> dotnet test .\src\Logic.Test\Logic.Test.csproj
Build started, please wait...
Build completed.

Test run for C:\gitroot\azure\aui\src\Logic.Test\bin\Debug\netcoreapp1.0\Logic.Test.dll(.NETCoreApp,Version=v1.0)
Microsoft (R) Test Execution Command Line Tool Version 15.0.0.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
An exception occurred while invoking executor 'executor://nunit3testexecutor/': Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
@OsirisTerje OsirisTerje added is:bug confirm We need a separate confirmation of this issue and removed is:bug labels Jul 21, 2017
@OsirisTerje
Copy link
Member

@gyorgynadaban I am testing this using https://github.com/rprouse/NUnitPlatformTests , and can't repro. Can you check using the same repo, you should see 50 passed tests, 2 skipped and 2 failed.

@rprouse
Copy link
Member

rprouse commented Jul 21, 2017

@gyorgynadaban is your project multi-targetted? Can you post a copy of your CSPROJ file?

NUnit does depend on System.Runtime.InteropServices.RuntimeInformation. If you look at the adapter in NuGet, https://www.nuget.org/packages/NUnit3TestAdapter/ we depend on Microsoft.DotNet.InternalAbstractions which pulls in the System.Runtime.InteropServices.RuntimeInformation.

image

You've also added a reference to Microsoft.NET.Test.Sdk?

I tried to reproduce and cannot, I created a new project with the following CSPROJ,

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp1.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
    <PackageReference Include="NUnit" Version="3.7.1" />
    <PackageReference Include="NUnit3TestAdapter" Version="3.8.0" />
  </ItemGroup>

  <ItemGroup>
    <Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
  </ItemGroup>

</Project>

From the command line in the project directory, I run dotnet test,

C:\src\Spikes\CoreTests\CoreTests [master +1 ~1 -1 !]
λ dotnet test
Build started, please wait...
Build completed.

Test run for C:\src\Spikes\CoreTests\CoreTests\bin\Debug\netcoreapp1.1\CoreTests.dll(.NETCoreApp,Version=v1.1)
Microsoft (R) Test Execution Command Line Tool Version 15.0.0.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
NUnit Adapter 3.8.0.0: Test execution started
Running all tests in C:\src\Spikes\CoreTests\CoreTests\bin\Debug\netcoreapp1.1\CoreTests.dll
NUnit3TestExecutor converted 1 of 1 NUnit test cases
NUnit Adapter 3.8.0.0: Test execution complete

Total tests: 1. Passed: 1. Failed: 0. Skipped: 0.
Test Run Successful.
Test execution time: 0.9971 Seconds

Also check out, http://www.alteridem.net/2017/05/04/test-net-core-nunit-vs2017/

@rprouse
Copy link
Member

rprouse commented Jul 21, 2017

My mistake, I switched the above from netcoreapp1.1 to netcoreapp1.0 and get the error you mentioned.

I'm not sure why this is working in the test solution, we will need to look into it.

Workaround for now is to switch to netcoreapp1.1 for now.

@rprouse rprouse added is:bug pri:normal and removed confirm We need a separate confirmation of this issue labels Jul 21, 2017
@rprouse
Copy link
Member

rprouse commented Jul 21, 2017

It looks like targeting netcoreapp1.0 causes a reference to System.Runtime.InteropServices.RuntimeInformation version 4.0.0 to get pulled in. A second workaround is to add System.Runtime.InteropServices.RuntimeInformation` version 4.3.0 as a dependency.

We could add this as a NuGet dependency to fix.

@halex2005
Copy link
Contributor

@rprouse, can you review and approve #418?

@rprouse rprouse closed this as completed Nov 19, 2017
@rprouse rprouse added this to the 3.10 milestone Nov 19, 2017
smadala added a commit to smadala/vstest that referenced this issue Jan 29, 2018
smadala added a commit to microsoft/vstest that referenced this issue Feb 5, 2018
* Run acceptance tests in parallel

* Use MSTest 1.3.0-beta2

* Make execution scope class level

* Restrcture translationlayer tests

* Fix build failures

* Pass target platform in runsettings

* revert experiment changes

* Read deps file in readonly mode

* Fix DotnetTestHostManagerTests unit tests

* Pass Framework explicitly

* Remove logfile from TL

* Update nunit adapter version to fix nunit/nunit3-vs-adapter#365

* Update error message for acceptance test

* Disable in assembly parallel

* change targetframes order

* Fix ubuntu build failure by adding System.Reflection reference

* Fix build failure after merge with master

* Fix flaky test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants