Hi,
I updated to the most recent MSTest meta package recently and resolved a number of analyzer warnings,
MSTEST0049 being one of them. The suggested fix for that warning is to leverage the TestContext.CancellationTokenSource.Token property when invoking asynchronous methods with cancellation token parameters. The test context injected by NCrunch has a null CancellationTokenSource property however preventing this from being used.
Further to this, the latest
documentation from Microsoft suggests constructor injection of the test context being the recommended way of obtaining a test context. NCrunch however requires there to be a parameterless constructor defined, so this approach cannot be used either.
Code:
System.MissingMethodException: Cannot dynamically create an instance of type 'MyTests'. Reason: No parameterless constructor defined.
at System.RuntimeType.ActivatorCache..ctor(RuntimeType rt)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
at nCrunch.TestExecution.Reflection.Clr.ClrType.CreateInstance()
at nCrunch.Module.MSTest.Integration.MSTestTest.tryCreateFixtureInstance()
I'm aware of the murky nature of the MSTest emulation in NCrunch, but are either of these issues something that can be addressed?
NCrunch 5.16.0.5 in Visual Studio by the way.