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

Strange message if test fails with preview 5.0.100-preview.2.20176.6 #2384

Closed
MarcoRossignoli opened this issue Apr 5, 2020 · 21 comments · Fixed by #2557
Closed

Strange message if test fails with preview 5.0.100-preview.2.20176.6 #2384

MarcoRossignoli opened this issue Apr 5, 2020 · 21 comments · Fixed by #2557

Comments

@MarcoRossignoli
Copy link
Contributor

If a test fails I get strange output at the end of tests for a test project

C:\Program Files\dotnet\sdk\5.0.100-preview.2.20176.6\Microsoft.TestPlatform.targets(32,5): error MSB4132: The "Microsoft.TestPlatform.Build.Tasks.VSTestTask" task returned false but did not log an error. [C:\git\coverlet\test\coverlet.core.tests\coverlet.core.tests.csproj]

It doesn't happen if I pin sdk to 3.1.201

λ dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   5.0.100-preview.2.20176.6
 Commit:    d752c3e07b

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.18363
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\5.0.100-preview.2.20176.6\

Host (useful for support):
  Version: 5.0.0-preview.2.20160.6
  Commit:  d12f79a4d1

.NET Core SDKs installed:
  2.2.207 [C:\Program Files\dotnet\sdk]
  3.0.103 [C:\Program Files\dotnet\sdk]
  3.1.200-preview-015002 [C:\Program Files\dotnet\sdk]
  3.1.201 [C:\Program Files\dotnet\sdk]
  3.1.300-preview-015048 [C:\Program Files\dotnet\sdk]
  5.0.100-preview.2.20176.6 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.0-preview.2.20167.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.0-preview.2.20160.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.0-preview.2.20160.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
@Dreamescaper
Copy link

Dreamescaper commented Aug 10, 2020

Same happens for me with 3.1.400.

@nohwnd
Copy link
Member

nohwnd commented Aug 11, 2020

I think this message is a feature of msbuild that is only printed in previews. They wanted to enable it for release builds as well, but because the error was confusing they did not. At least that is what I understood from the brief mention in some meeting, but I don't know who to ask now. 🙂

@nohwnd
Copy link
Member

nohwnd commented Aug 11, 2020

Either that or we are not following some contract correctly. dotnet/msbuild#5508

@Dreamescaper
Copy link

@nohwnd
It happens for me on stable dotnet (3.1.400).

@valtbarbos
Copy link

@nohwnd
It happens for me on stable dotnet (3.1.400).

Originally posted by @Dreamescaper in #2384 (comment)

dotnet 3.1.401

/usr/share/dotnet/sdk/3.1.401/Microsoft.TestPlatform.targets(32,5): error MSB4181: The "Microsoft.TestPlatform.Build.Tasks.VSTestTask" task returned false but did not log an error.

@adrianiftode
Copy link

Same happens with 3.1.401, but not with 3.1.202

@johndaintree
Copy link

I get this error after upgrading from 3.1 to 5.0. My test ouput (via coverlet) is as follows:

./test.ps1
Test run for F:\devt\src\19.0.core\svn\netcore\tests\bin\Debug\net5.0\tests.dll(.NETCoreApp,Version=v5.0)
Microsoft (R) Test Execution Command Line Tool Version 16.8.0-preview-20200811-01
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Microsoft.VisualStudio.TestPlatform.ObjectModel.SettingsException: Invalid settings 'RunConfiguration'. Invalid value 'net5.0' specified for 'TargetFrameworkVersion'.
at Microsoft.VisualStudio.TestPlatform.ObjectModel.RunConfiguration.FromXml(XmlReader reader)
at Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities.XmlRunSettingsUtilities.GetNodeValue[T](String settingsXml, String nodeName, Func2 nodeParser) at Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities.XmlRunSettingsUtilities.GetRunConfigurationNode(String settingsXml) at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.BaseRunTests.SetContext() at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.BaseRunTests..ctor(IRequestData requestData, String package, String runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler testRunEventsHandler, ITestPlatformEventSource testPlatformEventSource, ITestEventsPublisher testEventsPublisher, IThread platformThread, IDataSerializer dataSerializer) at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.BaseRunTests..ctor(IRequestData requestData, String package, String runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler testRunEventsHandler, ITestPlatformEventSource testPlatformEventSource) at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.RunTestsWithSources..ctor(IRequestData requestData, Dictionary2 adapterSourceMap, String package, String runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler testRunEventsHandler, Dictionary2 executorUriVsSourceList) at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.RunTestsWithSources..ctor(IRequestData requestData, Dictionary2 adapterSourceMap, String package, String runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler testRunEventsHandler)
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.ExecutionManager.StartTestRun(Dictionary`2 adapterSourceMap, String package, String runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler runEventsHandler)
Test Run Aborted.
C:\Program Files\dotnet\sdk\5.0.100-preview.8.20417.9\Microsoft.TestPlatform.targets(32,5): error MSB4181: The "Microsoft.TestPlatform.Build.Tasks.VSTestTask" task returned false but did not log an error. [F:\devt\src\19.0.core\svn\netcore\tests\tests.csproj]

@nohwnd
Copy link
Member

nohwnd commented Sep 2, 2020

@johndaintree we've seen this happen with the latest dotnet 5.0 SDKs and with Microsoft.NET.Test.Sdk nuget package in version 16.2.0 or older. Which version are you using?

@nohwnd
Copy link
Member

nohwnd commented Sep 2, 2020

This is caused by Nuget.Frameworks, change that started returning net5.0 in the DotNetFrameworkName, this change was reverted and I cannot reproduce the issue on the latest RC1 build from https://github.com/dotnet/installer#installers-and-binaries

It does not reproduce on Preview7, reproduces on Preview8 and reproduces on older versions of RC1, but not on recent versions of RC1.

@johndaintree
Copy link

@nohwnd dotnet info follows. I'm on preview 8, but I'm happy to try RC1. Looks like I'm using Microsoft.NET.Test.Sdk 16.1.0, so it's probably wise for me to update that too.

dotnet --info
.NET SDK (reflecting any global.json):
Version: 5.0.100-preview.8.20417.9
Commit: fc62663a35

Runtime Environment:
OS Name: Windows
OS Version: 10.0.20201
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.100-preview.8.20417.9\

Host (useful for support):
Version: 5.0.0-preview.8.20407.11
Commit: bf456654f9

.NET SDKs installed:
1.0.4 [C:\Program Files\dotnet\sdk]
2.1.4 [C:\Program Files\dotnet\sdk]
2.1.100 [C:\Program Files\dotnet\sdk]
2.1.202 [C:\Program Files\dotnet\sdk]
3.0.100-preview8-013656 [C:\Program Files\dotnet\sdk]
3.1.301 [C:\Program Files\dotnet\sdk]
3.1.401 [C:\Program Files\dotnet\sdk]
5.0.100-preview.8.20417.9 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0-preview8.19405.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-preview.8.20414.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0-preview8-28405-07 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-preview.8.20407.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0-preview8-28405-07 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.0-preview.8.20411.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download

@nohwnd
Copy link
Member

nohwnd commented Sep 2, 2020

@johndaintree yeah it will fail that way on this Preview8 build. If you get todays RC1 from dotnet/installer it will work. It will also work if you update Test.SDK to 16.3.0 or newer.

One last thing you might run into if you decide to just update is that xUnit tests are also affected by this. And will show No test is available in <assembly> Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.. Unless you are using xunit.visualstudio.runner 2.4.3 see https://github.com/dotnet/core/blob/d91069887dee1c053159333c8619d1a4039c2d53/release-notes/5.0/5.0-known-issues.md#preview-8-1

@johndaintree
Copy link

@nohwnd, thanks. I'll try all that. :)

@nohwnd
Copy link
Member

nohwnd commented Sep 3, 2020

This will continue to happen until they fix it in MSBuild, but we are setting the property, so once they fix it the message will go away.

@meer93
Copy link

meer93 commented Sep 10, 2020

I was getting the same error with .NET Core 3.1. Thought of sharing my experience and how I resolved it.

I ran dotnet test command with normal verbosity (appending "-v n") and found the error came because of some target mismatch between .sln and .csproj files.

I deleted the .sln file and then ran the test(via dotnet test command) and error was no more.

@johndaintree
Copy link

I can confirm that this problem went away (for me) with 5,0 RC1

@loop-evgeny
Copy link

Happens to me on SDK 3.1.402, too. It happens consistently when a test fails, but also intermittently when all tests pass: dotnet/sdk#13431

@mwpowellhtx
Copy link

Same for me, MSB4181 trying to run some tooling, an MSBuild Task to BumpAssemblyVersions. I get the same thing trying to run against a WindowsDesktop WinExe WinForms netcoreapp3.1 build.

@nohwnd
Copy link
Member

nohwnd commented Oct 22, 2020

@mwpowellhtx this should be fixed in 5.0-rc2, but will continue to happen on 3.1, there is servicing fix dotnet/toolset#4941 up for consideration, so hopefully the committee deciding about that will approve and merge.

@mwpowellhtx
Copy link

@nohwnd Appreciate the update, thank you. Is there anything I can do on my end? Pin a runtimeconfig.json to my tooling to avoid this embarrassing snafu? Thank you...

@nohwnd
Copy link
Member

nohwnd commented Oct 22, 2020

You can stick with older 3.1 sdk.

dotnet/sdk#13431 (comment)

@marinovdh
Copy link

In my case I was just missing NuGet package Microsoft.NET.Test.Sdk in my solution's test project...

This issue was closed.
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

Successfully merging a pull request may close this issue.

10 participants