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

System.IO.FileNotFoundException when down-targeting to netcoreapp1.0 #1601

Closed
jeremymeng opened this issue Dec 28, 2017 · 10 comments
Closed

Comments

@jeremymeng
Copy link

repro steps

dotnet new xunit -o repro
cd repro
notepad repro.csproj

change the TargetFramework from netcoreapp2.0 to netcoreapp1.0. Now the content is

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

  <PropertyGroup>
    <TargetFramework>netcoreapp1.0</TargetFramework>

    <IsPackable>false</IsPackable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
    <PackageReference Include="xunit" Version="2.3.1" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
    <DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
  </ItemGroup>

</Project>

switch back to command prompt and run

dotnet restore
dotnet xunit

Actual:

Detecting target frameworks in repro.csproj...
Building for framework netcoreapp1.0...
  repro -> E:\temp\repro\bin\Debug\netcoreapp1.0\repro.dll
Running .NET Core 1.0.5 tests for framework netcoreapp1.0...
xUnit.net Console Runner (64-bit .NET Core 4.0.0.0)
System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load the specified file.

Note
dotnet test works fine

.NET Core SDK 2.1.3 is used, I have 1.0.5 runtime installed

 Directory of E:\Program Files\dotnet\shared\Microsoft.NETCore.App

12/28/2017  10:29 AM    <DIR>          .
12/28/2017  10:29 AM    <DIR>          ..
12/28/2017  09:55 AM    <DIR>          1.0.4
12/28/2017  10:29 AM    <DIR>          1.0.5
12/28/2017  09:55 AM    <DIR>          1.1.1
12/27/2017  04:34 PM    <DIR>          2.0.4
@bradwilson
Copy link
Member

bradwilson commented Dec 28, 2017

I'm unable to reproduce the issue:

@jeremymeng
Copy link
Author

It must be some machine/configuration difference. It originally happened in this appveyor PR build: https://ci.appveyor.com/project/StackExchange/stackexchange-redis/build/1.0.504

@bradwilson
Copy link
Member

Verified that this is already fixed in 2.4.0-beta1-build3907.

@bradwilson
Copy link
Member

bradwilson commented Jan 2, 2018

This appears to be somehow related to the presence (or absence) of xunit.runner.visualstudio; when it's present, everything works (and when absent, everything fails).

At this point in time, I have no idea why that might be. The difference between the .deps.json files does not indicate anything out of the expected.

@bradwilson bradwilson reopened this Jan 2, 2018
@bradwilson
Copy link
Member

So, in case it isn't clear: anybody who is experiencing this problem only needs to add the xunit.runner.visualstudio package (as well as using 2.4.0-beta1-build3907 or later) to resolve the issue.

jeremymeng added a commit to jeremymeng/StackExchange.Redis that referenced this issue Jan 2, 2018
jeremymeng added a commit to jeremymeng/StackExchange.Redis that referenced this issue Jan 2, 2018
ctaggart added a commit to ctaggart/netmq that referenced this issue Jan 2, 2018
ctaggart added a commit to ctaggart/netmq that referenced this issue Jan 2, 2018
* see if you can just run off of 1.0.4

* try xunit 2.4.0-beta1-build3908
xunit/xunit#1601

* put back other framework tests
drewnoakes pushed a commit to zeromq/netmq that referenced this issue Jan 12, 2018
* try just dotnet 2.1.3

* install 1.0.8 too

* 1.0.8 was not valid

* 1.1.5 is current

* just 1.1.5

* runtime 1.1.5

* dotnet --info

* its already printed

* see if there is a 1.0.4 package

* remove explicit RuntimeFrameworkVersion

* just run the test on 2.0

* "2.0"

* specify runtime 2.0.4

* src/NetMQ.Tests

* run with dotnet xunit

* verbose to avoid 10 minute timeout

* skip BothSpeakerAndListenerOverLoopback

* skip TestKeepalive that throws PlatformNotSupportedException

* Ipv6ToIpv6 test is timing out on Travis CI

* disable failing Serialisation test

* skip BothSpeakerAndListener

* use dotnet xunit for appveyor too (#1)

* see if parallel of none avoids timeout

* net452 is min supported by xunit 2.2 and higher

* still skip

* print runtimes on appveyor

* use dotnet xunit on appveyor

* too many -f

* 1.0.5 is failing with Could not load file or assembly 'System.Runtime.Extensions, Version=4.0.0.0

* skip CleanupTests Block

* add tests for netcoreapp1.0 (#2)

* see if you can just run off of 1.0.4

* try xunit 2.4.0-beta1-build3908
xunit/xunit#1601

* put back other framework tests

* trigger another build
@VictorioBerra
Copy link

VictorioBerra commented Feb 13, 2018

Using 2.4.0-beta.1.build3958 did not solve the issue for me.

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

  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="xunit" Version="2.4.0-beta.1.build3958" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.0-beta.1.build3958" />
  </ItemGroup>

</Project>

Command used to execute tests:

C:/SourceCode/MyApp/tools/xunit.runner.console.2.4.0-beta.1.build3958/tools/netcoreapp1.0/xunit.console.dll "C:/SourceCode/MyApp/tests/MyApp.UnitTests/bin/Release/netcoreapp2.0/MyApp.UnitTests.dll" -xml "artifacts/testresults/results.xml"

@bradwilson
Copy link
Member

@VictorioBerra Please open a new issue with a repro project.

@VictorioBerra
Copy link

@bradwilson My issue was that I was trying to use xunit.runner.console.2.3.1\tools\netcoreapp1.0 to run a netcoreapp2.0 test library. I missed it because of my cake file strings.

NickCraver pushed a commit to StackExchange/StackExchange.Redis that referenced this issue Mar 10, 2018
* Give defaultClientName a value when it is null
This prevents calling TryGetAzureRoleInstanceIdNoThrow() repeatedly in the null case.
* Upgrade xunit to 2.3.1
* Upgrade xunit to v2.4.0-beta1 to work around xunit/xunit#1601
* Move xUnit to 2.4.0-beta.1.build3958
@NickCraver
Copy link
Contributor

Is there any chance of merging #1643 in? We can't use the 2.4.0 beta because of the issue there, and 2.3.1 breaks due to the issue here - AFAIK there's no build available for which all tests run (since MyGet was cleared a while back).

@bradwilson
Copy link
Member

Closing for age and that it appears to no longer be relevant.

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

4 participants