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.

Updating Microsoft.NET.Test.Sdk, Microsoft.TestPlatform.TestHost from 16.2.0 causes netcoreapp2.0 tests to stop working

See original GitHub issue

Description

Updating both packages from 16.2.0 to 16.3.0 causes this compiler error:

Error CS0234 The type or namespace name ‘TestPlatform’ does not exist in the namespace ‘Microsoft.VisualStudio’ (are you missing an assembly reference?) Tests.Core d:\NuGet\microsoft.net.test.sdk\16.3.0\build\netcoreapp1.0\Microsoft.NET.Test.Sdk.Program.cs

In an auto-generated file:

// <auto-generated> This file has been auto generated. </auto-generated>
using System;
[Microsoft.VisualStudio.TestPlatform.TestSDKAutoGeneratedCode]
class AutoGeneratedProgram {static void Main(string[] args){}}

Updating to 16.4.0 causes this exception in the Tests tab:

[12/01/2019 11:08:54.113 AM Informational] Store opened in 0.039 sec. [12/01/2019 11:08:57.245 AM Error] StreamJsonRpc.RemoteInvocationException: The following TestContainer was not found ‘Tests.Core\bin\Debug\netcoreapp2.0\Tests.Core.dll’ at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at StreamJsonRpc.JsonRpc.<InvokeCoreAsync>d__92`1.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.TestWindow.Host.TestStoreHandler.<AddSourceBasedTestsAsync>d__22.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.TestWindow.Extensibility.ILoggerExtensions.<CallWithCatchAsync>d__9.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

Steps to reproduce

  1. Have unit tests project targeting netcoreapp2.0 alone
  2. Install the following package
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.TestPlatform.TestHost" Version="16.2.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.0.0" />
<PackageReference Include="MSTest.TestFramework" Version="2.0.0" />
  1. Observer tests can be discovered and successfully ran using both VS and dotnet test.

Expected behavior

Updating to either newer version continues to work.

Actual behavior

Updating to either newer version doesn’t work, see the error above.

Environment

  • Windows 10.0.18363 Build 18363
  • Visual Studio Enterprise 16.3.10
  • MSTest 2.0.0 (from NuGet.org)

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
abatishchevcommented, Jan 14, 2020

Here’s a repro repo: https://github.com/jwt-dotnet/jwt/tree/temp/mstest, the branch is called temp/mstest where I removed xUnit and didn’t add MSTest2 yet. You will be able to repro both issues from the initial posting.

0reactions
Haploiscommented, Jul 8, 2021

The target framework ‘netcoreapp2.0’ is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NET Core MSTest project can't find VisualStudio type or ...
The type or namespace name 'VisualStudio' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
Read more >
Testhost process exited with error: You must install or ...
I am facing below error while running a test on build server . build Microsoft (R) Test Execution Command Line Tool Version 17.2.0...
Read more >
Testhost .NET Error - Developer Community
The workaround was to downgrade the Microsoft.NET.Test.Sdk package to 16.2.0. With 16.3.0 or 16.4.0, my tests do not run ever since I applied ......
Read more >
Microsoft.NET.Test.Sdk 17.7.1
Version Downloads Last updated 17.8.0‑preview‑23371‑04 9,418 18 days ago 17.7.1 130,840 5 days ago 17.7.0 642,735 17 days ago
Read more >
Unit tests not detected in .NET Core test project with Microsoft ...
Create a .NET Core 2.1 test project using either NUnit (3.12.0) or xUnit (2.4.1) · Ensure the Microsoft.NET.Test.Sdk NuGet package is at version...
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