question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dotnet test fails to find system.runtime with netcoreapp

See original GitHub issue

Steps to reproduce

  1. Create a test project that targets netcoreapp1.0
  2. dotnet restore --infer-runtimes
  3. dotnet test

project.json

{
  "dependencies": {
    "NuGet.Versioning": {
      "target": "project"
    },
    "xunit": "2.1.0"
  },
  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "netstandardapp1.5",
        "dnxcore50",
        "portable-net45+win8"
      ],
      "dependencies": {
        "dotnet-test-xunit": "1.0.0-dev-140469-38",
        "Microsoft.NETCore.App": {
          "version": "1.0.0-rc2-3002339"
        }
      }
    },
    "net46": {
      "frameworkAssemblies": {
        "Microsoft.CSharp": "",
        "System": "",
        "System.Core": "",
        "System.Runtime": "",
        "System.Threading.Tasks": ""
      }
    }
  },
  "testRunner": "xunit"
}

Expected behavior

Tests will run

Actual behavior

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0-rc2-002339)

Product Information:
 Version:     1.0.0-rc2-002339
 Commit Sha:  2be5e84f87

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

@pakrym helped debug this. Without --runtimeconfig tests run.

Trace:

C:\src\NuGet.Client\cli\shared\Microsoft.NETCore.App\1.0.0-rc2-3002339\corehost.exe : Tracing enabled
At line:1 char:2
+  C:\src\NuGet.Client\cli\shared\Microsoft.NETCore.App\1.0.0-rc2-30023 ...
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Tracing enabled:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError


--- Invoked policy [Microsoft.NETCore.DotNetHostPolicy/1.0.1-rc2-002339/runtimes/win7-x64/native] main = {
C:\src\NuGet.Client\cli\shared\Microsoft.NETCore.App\1.0.0-rc2-3002339\corehost.exe
C:\Users\juste\.nuget\packages\dotnet-test-xunit\1.0.0-dev-140469-38\lib\netstandard1.5\dotnet-test-xunit.dll
--runtimeconfig
C:\src\NuGet.Client\test\NuGet.Core.Tests\NuGet.Versioning.Test\bin\Debug\netcoreapp1.0\win7-x64\NuGet.Versioning.Test.runtimeconfig.json
--depsfile
C:\src\NuGet.Client\test\NuGet.Core.Tests\NuGet.Versioning.Test\bin\Debug\netcoreapp1.0\win7-x64\NuGet.Versioning.Test.deps.json
--additionalprobingpath
C:\Users\juste\.nuget\packages
C:\src\NuGet.Client\test\NuGet.Core.Tests\NuGet.Versioning.Test\bin\Debug\netcoreapp1.0\NuGet.Versioning.Test.dll
}
Host mode: 3
Deps file: 
-- arguments_t: own_path=C:\src\NuGet.Client\cli\shared\Microsoft.NETCore.App\1.0.0-rc2-3002339\corehost.exe app_dir=C:\Users\juste\.nuget\packages\dotnet-test-xunit\1.0.0-dev-140469-38\lib\netstandard1.5 
deps=C:\Users\juste\.nuget\packages\dotnet-test-xunit\1.0.0-dev-140469-38\lib\netstandard1.5\dotnet-test-xunit.deps.json extensions=C:\Program Files (x86)\dotnetextensions packages_cache= 
mgd_app=C:\Users\juste\.nuget\packages\dotnet-test-xunit\1.0.0-dev-140469-38\lib\netstandard1.5\dotnet-test-xunit.dll
Runtime config is cfg=C:\Users\juste\.nuget\packages\dotnet-test-xunit\1.0.0-dev-140469-38\lib\netstandard1.5\dotnet-test-xunit.runtimeconfig.json 
dev=C:\Users\juste\.nuget\packages\dotnet-test-xunit\1.0.0-dev-140469-38\lib\netstandard1.5\dotnet-test-xunit.runtimeconfig.dev.json
Attempting to read runtime config: C:\Users\juste\.nuget\packages\dotnet-test-xunit\1.0.0-dev-140469-38\lib\netstandard1.5\dotnet-test-xunit.runtimeconfig.json
Attempting to read dev runtime config: C:\Users\juste\.nuget\packages\dotnet-test-xunit\1.0.0-dev-140469-38\lib\netstandard1.5\dotnet-test-xunit.runtimeconfig.dev.json
Runtime config [C:\Users\juste\.nuget\packages\dotnet-test-xunit\1.0.0-dev-140469-38\lib\netstandard1.5\dotnet-test-xunit.runtimeconfig.json] is valid=[1]
Deps file does not exist [C:\Users\juste\.nuget\packages\dotnet-test-xunit\1.0.0-dev-140469-38\lib\netstandard1.5\dotnet-test-xunit.deps.json]
-- Listing probe configurations...
probe_config_t: probe=[C:\src\NuGet.Client\cli\shared\Microsoft.NETCore.App\1.0.0-rc2-3002339] match-hash=[0] patch-roll-forward=[0] prerelease-roll-forward=[0] deps-json=[0000000000000000]
-- Starting CoreCLR Probe from app deps.json
Deps has no coreclr entry.
Probing for CoreCLR in deps directory=[C:\Users\juste\.nuget\packages\dotnet-test-xunit\1.0.0-dev-140469-38\lib\netstandard1.5]
Checking if CoreCLR path exists=[C:\Users\juste\.nuget\packages\dotnet-test-xunit\1.0.0-dev-140469-38\lib\netstandard1.5\coreclr.dll]
Checking if CoreCLR path exists=[C:\Users\juste\AppData\Local\dotnet\runtime\coreclr\coreclr.dll]
Checking if CoreCLR path exists=[C:\Program Files\dotnet\bin\coreclr.dll]
CoreCLR directory: C:\Program Files\dotnet\bin
Adding files from local dir C:\Users\juste\.nuget\packages\dotnet-test-xunit\1.0.0-dev-140469-38\lib\netstandard1.5
Adding dotnet-test-xunit to local assembly set from C:\Users\juste\.nuget\packages\dotnet-test-xunit\1.0.0-dev-140469-38\lib\netstandard1.5\dotnet-test-xunit.dll
Adding tpa entry: C:\Users\juste\.nuget\packages\dotnet-test-xunit\1.0.0-dev-140469-38\lib\netstandard1.5\dotnet-test-xunit.dll
Adding to native path: C:\Users\juste\.nuget\packages\dotnet-test-xunit\1.0.0-dev-140469-38\lib\netstandard1.5
Adding to native path: C:\src\NuGet.Client\cli\shared\Microsoft.NETCore.App\1.0.0-rc2-3002339
Adding to native path: C:\Program Files\dotnet\bin
Adding to resources path: C:\Users\juste\.nuget\packages\dotnet-test-xunit\1.0.0-dev-140469-38\lib\netstandard1.5
Adding to resources path: C:\src\NuGet.Client\cli\shared\Microsoft.NETCore.App\1.0.0-rc2-3002339
Adding to resources path: C:\Program Files\dotnet\bin
Setting PATH=D:\tools\ConEmuPack\ConEmu\Scripts;D:\tools\ConEmuPack;D:\tools\ConEmuPack\ConEmu;C:\ProgramDa
ta\Oracle\Java\javapat

Unhandled Exception:

System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
brthorcommented, Apr 11, 2016

dotnet/cli#2392 Will fix the --runtimeconfig issue here.

0reactions
emgartencommented, Apr 11, 2016

@eerhardt that could be the cause…

Read more comments on GitHub >

github_iconTop Results From Across the Web

.Net Core 3.1 Function App Unit Test Fails trying to find ...
The only place I can see this dependency referenced is in the Solution -> Dependencies -> Frameworks -> Microsoft.NETCore.App location. I'm not ...
Read more >
dotnet test fails on sdk 6.0.200 - System. ...
An exception is thrown when I run dotnet test , after updating to SDK version 6.0.200. It works perfectly with SDK versions 6.0.101...
Read more >
too particular about .NET Core runtime version
Looking at the Tests output window pane, I see this: Testhost process exited with error: It was not possible to find any compatible...
Read more >
NETSDK1045: The current .NET SDK does not support ...
This error occurs when the build tools can't find the version of the .NET SDK that's needed to build a project. This is...
Read more >
Problems with .NET unit testing
Go to the directory with dotnet executable via terminal. Run "dotnet --version" command.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found