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

.NET Core XUnit project in .Net Core raises warnings on TypeLoadException #840

Closed
MiaomiaoHuangfu opened this issue Jun 5, 2017 · 8 comments
Assignees

Comments

@MiaomiaoHuangfu
Copy link

Description

For .NET Core xUnit test project, Run tests and display a warning in the output window:
Exception discovering tests: System.TypeLoadException: Could not load type 'System.Runtime.Remoting.Channels.IChannel' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. at Xunit.RemotingUtility.CleanUpRegisteredChannels() at Xunit.Runner.VisualStudio.TestAdapter.VsTestRunner.DiscoverTests[TVisitor](IEnumerable1 sources, LoggerHelper logger, Func4 visitorFactory, Action4 visitComplete)`

Steps to reproduce

Create a xUnit Test project (.NET Core);
build the project;

  1. In Test Explorer, right click the test and click "Run Selected Tests"
  2. In code editor, right click the test and click "Run Tests"

Expected behavior

Run passed with no error or warning

Actual behavior

There is a warning is output window:
xunitwarning

Environment

Install d15prerel.26604.01
Install latest CLI/SDK 2.0. from https://github.com/dotnet/cli/tree/release/2.0.0
Operating system: Windows 10 x64 ENU
Build version of vstest.console: 15.0.26604.1
dotnet --info
`.NET Command Line Tools (2.0.0-preview2-006341)

Product Information:
Version: 2.0.0-preview2-006341
Commit SHA-1 hash: 19d305783b

Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.0.0-preview2-006341\

Microsoft .NET Core Shared Framework Host

Version : 2.0.0-preview2-25402-02
Build : 3c440c8947e7776b2c7772bcb98b3bc73e1b9193`

@Faizan2304
Copy link
Contributor

@MiaomiaoHuangfu : Can you please provide me repro machine ?

@MiaomiaoHuangfu
Copy link
Author

Repro machine name: E2E-008
Login account: Redmond\corbvt

@Faizan2304
Copy link
Contributor

Fix will come in next preview of visual studio, most probably visual studio 2017 update3 preview3 will have it.

livarcocc added a commit to dotnet/cli that referenced this issue Jun 20, 2017
…se/2.0.0-to-master-20170620-070043

* dotnet/release/2.0.0: (34 commits)
  Simple clean up to the store tests
  Updating xlf files for the Configurer.
  Removing NuGetConfig from the first run experience and replacing the sentinel with the FirstUseNoticeSentinel when needed.
  Moving the expanding fallback folder to the dotnet folder hive. The folder will be expanded at sdk/NuGetFallbackFolder.
  Fixing CRLF issue.
  Updating xlf and fixing line ending problems with one file.
  Add rhel and Debian download link
  Fix race in telemetry msbuild arg tests
  Avoid repeating the first-run message if lzma archive is missing
  Use fluent helper for line-end normalization
  Update CoreSetup to preview3-25419-01
  Updating Roslyn to 2.3.0-beta3-61816-04
  Update CoreSetup to preview3-25418-01
  insert new tpv2 which fixes following issue microsoft/vstest#632 microsoft/vstest#844 microsoft/vstest#847 microsoft/vstest#840 microsoft/vstest#843
  Windows installer refresh
  Update SDK to 1.1.0-alpha-20170615-3
  Updating NuGet to 4.3.0-preview3-4168
  MSBuild 15.3.388
  Make dotnet-sln-add.Tests pass on localized setup
  Make dotnet-sln-list.Tests pass on localized setup
  ...
livarcocc added a commit to dotnet/cli that referenced this issue Jun 21, 2017
…se/2.0.0-to-master-20170621-070039

* dotnet/release/2.0.0: (35 commits)
  Fixing an issue in the RepoDirectoriesProvider where it assumed that the only directory under SDK was the SDK directories. This is no longer true now that we moved the NuGet fallback folder there.
  Simple clean up to the store tests
  Updating xlf files for the Configurer.
  Removing NuGetConfig from the first run experience and replacing the sentinel with the FirstUseNoticeSentinel when needed.
  Moving the expanding fallback folder to the dotnet folder hive. The folder will be expanded at sdk/NuGetFallbackFolder.
  Fixing CRLF issue.
  Updating xlf and fixing line ending problems with one file.
  Add rhel and Debian download link
  Fix race in telemetry msbuild arg tests
  Avoid repeating the first-run message if lzma archive is missing
  Use fluent helper for line-end normalization
  Update CoreSetup to preview3-25419-01
  Updating Roslyn to 2.3.0-beta3-61816-04
  Update CoreSetup to preview3-25418-01
  insert new tpv2 which fixes following issue microsoft/vstest#632 microsoft/vstest#844 microsoft/vstest#847 microsoft/vstest#840 microsoft/vstest#843
  Windows installer refresh
  Update SDK to 1.1.0-alpha-20170615-3
  Updating NuGet to 4.3.0-preview3-4168
  MSBuild 15.3.388
  Make dotnet-sln-add.Tests pass on localized setup
  ...
@Liero
Copy link

Liero commented Aug 1, 2017

Still having the same problem:

Microsoft Visual Studio Enterprise 2017
Version 15.2 (26430.16) Release
VisualStudio.15.Release/15.2.0+26430.16
Microsoft .NET Framework
Version 4.7.02046
ASP.NET and Web Tools 2017 15.0.30503.0
ASP.NET Web Frameworks and Tools 2017 5.2.50303.0

@codito
Copy link
Contributor

codito commented Aug 2, 2017

@Liero can you please try latest 15.3 preview builds of VS, they can be downloaded from https://www.visualstudio.com/vs/preview/

@Liero
Copy link

Liero commented Aug 2, 2017

Unfortunatelly I can't try preview right now but I will install it as soon as stable version will be released. Meanwhile, is there some workaround?

@jasel-lewis
Copy link

jasel-lewis commented Nov 8, 2017

FWIW, clearing the Visual Studio Test Explorer Extensions cache folder solved this problem for me. Instructions can be found here (scroll down to the red/pink box immediately under the Running tests with Visual Studio section).

@berdon
Copy link

berdon commented Oct 5, 2018

At some point, the cache folder stopped existing in my %TEMP% directory. Doing a rm -rf **/bin **/obj in the project directory fixed the issue. I presume it was an stale xunit dependency sticking around.

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

No branches or pull requests

6 participants