-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
dotnet test error MSB4181: The "Microsoft.TestPlatform.Build.Tasks.VSTestTask" task returned false but did not log an error #13431
Comments
@loop-evgeny could you please add args FYI: from a TeamCity build configuration you could publish it as build an artifact like |
Sure, here is the log I get from the attached trivial test project failing on Windows: diag-failure.log I also have logs from a TeamCity build on Linux where this error occurs even though all tests passed, but don't want to attach those publicly. Happy to send them directly to a .NET developer if that would help. Running .NET SDK 3.1.402 now on both the Windows machine and the Linux TeamCity build agent. |
any updates on this? We have the same issue |
MSBuild logs this error when ever a task's Execute method returns false, but no error has been logged. There are other instances where this can occur as well, e.g. if a task is interrupted/cancelled (dotnet/msbuild#5508). I did come across a fix in vstest for 16.8 (microsoft/vstest#2384 discusses the issue at length), PR https://github.com/microsoft/vstest/pull/2581/files (this is the issue @loop-evgeny previously mentioned. From the initial post it seemed 16.7 was being used. |
I too am now getting this error with nunit. It will error on
|
Do we have to wait for the next Core 3 Release to get this fix? |
We have been seeing similar error in our build pipelines. We are using |
@nohwnd if the fix in vstest you merged went into the 16.8 branch, I assume that means it's only available in 16.8 and not necessarily tied to a specific SDK build? We plan on updating 16.8 with a new 3.1.4xx SDK later this month. Or would this be a fix that supports all the SDKs in 16.8 (3.1 and 5.0)? |
How can i fix the issue?, i can't wait until the next release this month. My builds are failing in CodeBuild and i don't know why, I am seeing the same message. Here is the dotnet info: Running command dotnet --info.NET Core SDK (reflecting any global.json): .NET Core SDKs installed: |
@rainersigwald before trying to push fix for this through net3.1 servicing, do you see any workaround for this? I could not find any that would allow me to suppress the error externally. |
I'm looking for a workaround as well, is there an easy fix for this? |
There is not, or at least not any that I know of. The MSBxxxx errors cannot be suppressed by any parameters to MSBuild, so the only way to do this externally would be to build our version of the task and then use the extension point in the task to replace the DLL with another. Which is a hacky solution at best. You could also grab the net5.0 RC2 SDK that has this fixed and use that to build and test your project, while still targetting netcoreapp3.1 in your csproj, but that is not great either. |
Everything is red in our CI thanks to this problem. And you cannot expect every company to take risks on RC versions of the next SDK. Any updates on this? |
Well it writes that error only when there are failed (or cancelled) tests doesn't it? Or how does this make all your builds fail? |
@nohwnd msbuild returns 1 instead 0 when all tests are passed |
Tests tend to fail you know. This is how I know someone messed up. The fact that this step fails when tests fails hinders proper reporting afterwards. The CI does not report failed tests but failed builds. |
@nohwnd Our Team City Build is failing. We have some failing muted tests, but they are executed anyway and now our build is failing all the time... |
@danreg try changing the property one of build steps exited with an error (e.g non-zero exit code in command line runner) in Failure Conditions for your build configuration with test steps. |
@NikolayPianikov I can't do that. The build should fail, when tests are failing. But it must not fail, when muted tests are failing. |
@danreg Sorry I am not sure I understand. You could do the following:
That is all. After that you could mute or unmute your tests and everything should work as expected. |
I am getting the same error, trying to run tests inside dotnet 3.1 sdk latest Docker container. I also have some additional exception, which I am not sure if it is related or helpful, but here it is:
|
Okay, I have figured my problem out. Apparently it just highlights that errors inside |
As a workaround, I've installed the 3.1.302 SDK and added the following {
"sdk": {
"version": "3.1.302",
"rollForward": "disable"
}
} |
@ErikSchierboom Great observation, 👓 thank you. If we want to ensure that our MSBuild custom task, i.e. tooling, runs properly, then we can deploy that with a |
@totollygeek From what I've been able to determine, the issue is not contained to just |
@ErikSchierboom Wouldn't this downgrade the .NET Core version to 3.1.6? There have been 2 security updates published since then. Looks like SDK 3.1.109 might be a better choice |
@jvandertil Aha, fair point. |
In my case I could fix it by adding NuGet package Microsoft.NET.Test.Sdk to my solution's test project... |
@marinovdh that sounds odd, as the task responsible for the message is in a totally different part than the package you installed. But maybe I am overlooking something. Do you have a repro? |
I have the same diag stably reproduced with XUnit when:
|
@evilguest you see that message because that is just a different way to fail the VSTest msbuild task. But you can work around your particular problem, if you install a recent version of Microsoft.NET.Test.SDK and if your project is .NET Core. Because in .NET Core we translate Debug.Assert to an exception so it should not fail your whole project run. You will still see the MSB message till it is fixed, but your whole run won't fail. |
Thanks, will try that. At the moment I have no issues, since the bug causing the assertion failure has been fixed. Will consider this change upon the next occurence. As for the second issue - it is still actual, since it doesn't even indicate the test that fails. I had to triangulate the offender until located the specific call (the issue was the call convention mismatch on Unix) |
Just want to share that after .Net5 migration everything works again. |
I had to pull in below nuget packages to get around this issue.
|
Test segment was causing a false positive due to a known bug with Github workflows dotnet/sdk#13431
When running NUnit tests using
dotnet test
I sometimes get the following error at the end of the test run:This seems to always happen when at least one test failed. I have occasionally seen the same error when all tests pass on our TeamCity build servers, but cannot reproduce that. Output with a failing test, with the attached trivial test project:
Happened both on Windows 7 and on a Linux (Mint 19) VM.
dotnet --info on Windows:
and on Linux:
TestFailureTest.zip
The text was updated successfully, but these errors were encountered: