Build/Test Issues

Including '(' or ')' char in F# mstest class name leads to NullReferenceException

Started by slyvs on 2,651 views

In F# unit test project targeting net462 & referencing mstest v2 latest nuget.

namespace ns
open Microsoft.VisualStudio.TestTools.UnitTesting
open Swensen.Unquote
[<TestClass>]
type ``Liquid Crystal (LC) Calibration process tests``() =
    
    [<TestMethod>]
    member __.``Test Method``() =
        test <@ true @>


that (LC) thing causes NullReferenceException
> nCrunch.Module.MSTest.dll!nCrunch.Module.MSTest.Integration.MSTestRunner.runTestsWithinAssembly(System.Collections.Generic.IList<nCrunch.TestExecution.PendingTest> testsToRun, nCrunch.TestExecution.TestTaskOutput testOutput) Unknown No symbols loaded.
nCrunch.Common.dll!nCrunch.Common.PerformanceTracking.PerfTracker.TrackUnreliableActivity(string name, System.Action activity) Unknown No symbols loaded.
nCrunch.Common.dll!nCrunch.Common.PerformanceTracking.PerfTracker.TryTrackUnreliableActivity(string name, System.Action activity) Unknown No symbols loaded.
nCrunch.Module.MSTest.dll!nCrunch.Module.MSTest.Integration.MSTestRunner.RunTests(System.Collections.Generic.IList<nCrunch.TestExecution.PendingTest> testsToRun, nCrunch.TestExecution.TestTaskOutput testOutput) Unknown No symbols loaded.
nCrunch.TestExecution.dll!nCrunch.TestExecution.TestExecutionMonitor.PerformMonitoredTestExecution(System.Action testExecutionAction) Unknown No symbols loaded.
nCrunch.TestExecution.dll!nCrunch.TestExecution.TestRunnerThread.() Unknown No symbols loaded.
nCrunch.TestExecution.dll!nCrunch.TestExecution.TestRunnerThread.() Unknown No symbols loaded.
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown No symbols loaded.
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown No symbols loaded.
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Unknown No symbols loaded.
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() Unknown No symbols loaded.
[Native to Managed Transition] Annotated Frame

Hi, thanks for sharing this problem.

I think I can see how this could come about. It's caused by a hole in NCrunch's support for methods/classes that contain brackets in their names. In most .NET based languages, it isn't possible to create these, though F# seems to be the exception. I'll make a note to see if we can introduce a fix for this. For the time being, I recommend renaming the test class.

Post a reply

Log in to reply.