You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using Microsoft.VisualStudio.TestTools.UnitTesting;namespace TestProject1;[TestClass]publicclassTestClass1{[TestMethod]publicvoidTest(){
Assert.Fail();}}
dotnet test result
Microsoft (R) Test Execution Command Line Tool Version 17.4.0 (x64)
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Failed Test [17 ms]
Error Message:
Assert.Fail failed.
Stack Trace:
at TestProject1.TestClass1.Test() in C:\github\junk\TestProject2\TestProject1\UnitTest1.cs:line 11
Failed! - Failed: 1, Passed: 0, Skipped: 0, Total: 1, Duration: 30 ms - TestProject1.dll (net6.0)
Test run for C:\github\junk\TestProject2\TestProject1\bin\Debug\net7.0\TestProject1.dll (.NETCoreApp,Version=v7.0)
Microsoft (R) Test Execution Command Line Tool Version 17.4.0 (x64)
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Failed Test [16 ms]
Error Message:
Assert.Fail failed.
Stack Trace:
at TestProject1.TestClass1.Test() in C:\github\junk\TestProject2\TestProject1\UnitTest1.cs:line 11
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
Please note the following stack trace under .NET 7.0, which doesn't exist in .NET 6.0
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
It seems to be a bug of runtime that's postponed for .NET 8 (see dotnet/runtime#68923). I will see if we can do some kind of hack ourselves in the meantime for .NET 7.
I had a quick look and it seems to dangerous/unstable to introduce hack in MSTest to remove part of stack trace depending on runtime version. I will move forward by closing this issue.
dotnet test
resultPlease note the following stack trace under .NET 7.0, which doesn't exist in .NET 6.0
dotnet --list-sdks
resultThe text was updated successfully, but these errors were encountered: