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

MSTest 3.x.x fails in execution with whitespace in type name #1865

Closed
CaptnCodr opened this issue Dec 1, 2023 · 4 comments
Closed

MSTest 3.x.x fails in execution with whitespace in type name #1865

CaptnCodr opened this issue Dec 1, 2023 · 4 comments

Comments

@CaptnCodr
Copy link

CaptnCodr commented Dec 1, 2023

I wanted to upgrade from 2.1.2 to current MSTest.TestAdapter and MSTest.TestFramework v3.1.1, the following code will crash the test execution:

namespace TestiTest

open Microsoft.VisualStudio.TestTools.UnitTesting

[<TestClass>]
type ``This is a test type`` () =

    [<TestMethod>]
    member _.``This is a test`` () =
        Assert.IsTrue(true);

The output of that code is following:

Building Test Projects
========== Starting test run ==========
An exception occurred while invoking executor 'executor://mstestadapter/v2': Object reference not set to an instance of an object.
Stack trace:
   at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.UnitTestRunner.ClassCleanupManager.MarkTestComplete(TestMethodInfo testMethodInfo, TestMethod testMethod, Boolean& shouldRunEndOfClassCleanup, Boolean& shouldRunEndOfAssemblyCleanup) in /_/src/Adapter/MSTest.TestAdapter/Execution/UnitTestRunner.cs:line 315
   at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.UnitTestRunner.RunRequiredCleanups(ITestContext testContext, TestMethodInfo testMethodInfo, TestMethod testMethod, UnitTestResult[] results) in /_/src/Adapter/MSTest.TestAdapter/Execution/UnitTestRunner.cs:line 167
   at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.UnitTestRunner.RunSingleTest(TestMethod testMethod, IDictionary`2 testContextProperties) in /_/src/Adapter/MSTest.TestAdapter/Execution/UnitTestRunner.cs:line 145
   at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestExecutionManager.ExecuteTestsWithTestRunner(IEnumerable`1 tests, ITestExecutionRecorder testExecutionRecorder, String source, IDictionary`2 sourceLevelParameters, UnitTestRunner testRunner) in /_/src/Adapter/MSTest.TestAdapter/Execution/TestExecutionManager.cs:line 400
   at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestExecutionManager.ExecuteTestsInSource(IEnumerable`1 tests, IRunContext runContext, IFrameworkHandle frameworkHandle, String source, Boolean isDeploymentDone) in /_/src/Adapter/MSTest.TestAdapter/Execution/TestExecutionManager.cs:line 352
   at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestExecutionManager.ExecuteTests(IEnumerable`1 tests, IRunContext runContext, IFrameworkHandle frameworkHandle, Boolean isDeploymentDone) in /_/src/Adapter/MSTest.TestAdapter/Execution/TestExecutionManager.cs:line 155
   at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestExecutionManager.RunTests(IEnumerable`1 tests, IRunContext runContext, IFrameworkHandle frameworkHandle, TestRunCancellationToken runCancellationToken) in /_/src/Adapter/MSTest.TestAdapter/Execution/TestExecutionManager.cs:line 92
   at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.MSTestExecutor.RunTests(IEnumerable`1 tests, IRunContext runContext, IFrameworkHandle frameworkHandle) in /_/src/Adapter/MSTest.TestAdapter/MSTestExecutor.cs:line 72
   at Microsoft.VisualStudio.TestPlatform.Common.ExtensionDecorators.SerialTestRunDecorator.RunTests(IEnumerable`1 tests, IRunContext runContext, IFrameworkHandle frameworkHandle) in /_/src/Microsoft.TestPlatform.Common/ExtensionDecorators/SerialTestRunDecorator.cs:line 44
   at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.RunTestsWithTests.InvokeExecutor(LazyExtension`2 executor, Tuple`2 executorUri, RunContext runContext, IFrameworkHandle frameworkHandle) in /_/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/RunTestsWithTests.cs:line 72
   at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.BaseRunTests.RunTestInternalWithExecutors(IEnumerable`1 executorUriExtensionMap, Int64 totalTests) in /_/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/BaseRunTests.cs:line 466

========== Test run finished: 0 Tests (0 Passed, 0 Failed, 0 Skipped) run in 63 ms ==========

Visual Studio 17.8.2
dotnet --info:

.NET SDK:
 Version:           8.0.100
 Commit:            57efcf1350
 Workload version:  8.0.100-manifests.8d38d0cc

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.22631
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\8.0.100\

Steps To Reproduce

Just execute the F# code above with
MSTest.TestAdapter & MSTest.TestFramework both version 3.1.1
Microsoft.NET.Test.Sdk version 17.8.0

Additional context

Changing the code: type ``This is a test type`` () = to: type ``ThisIsATest`` () = will fix the code.
Probably are whitespaces not allowed here but in F# it's a valid type name.
I found this related issue: #941

AB#1925775

@Evangelink Evangelink self-assigned this Dec 5, 2023
@Evangelink
Copy link
Member

Hi @CaptnCodr,

Thanks for raising this issue. I can reproduce and will work on a fix soon.

@Evangelink
Copy link
Member

We will most likely be releasing 3.2.X in the upcoming weeks so I will hold closing this issue to see if we need to do some backport and release a 3.1.2 now.

@CaptnCodr
Copy link
Author

Thank you! 🙂

@Evangelink
Copy link
Member

We had a bit of delay but we are on track with final release for around 15th (maybe a bit sooner) so I'll move forward and close this issue. Feel free to comment/reopen if the ETA is too far away.

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

No branches or pull requests

2 participants