Rank: Newbie
Groups: Registered
Joined: 5/5/2016(UTC) Posts: 4 Location: United Kingdom
Thanks: 1 times
|
Environment: Visual Studio Version: 2017 (15.9.6) NCrunch: 3.23.0.10 Test Framework: NUnit (3.11) We're in the process of converting a number of our projects to NET Core/Net Standard and I've run into an issue with one particular solution. I'm getting errors similar to the following: - System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation. ----> System.TypeInitializationException : The type initializer for 'Exclaimer.Applications.ComodoProxy.WebApi.Tests.ExclaimerOrderNumberTests' threw an exception. ----> System.IndexOutOfRangeException : Index was outside the bounds of the array. at System.RuntimeFieldHandle.GetValue(RtFieldInfo field, Object instance, RuntimeType fieldType, RuntimeType declaringType, Boolean& domainInitialized) at System.Reflection.RtFieldInfo.UnsafeGetValue(Object obj) at System.Reflection.RtFieldInfo.GetValue(Object obj) at NUnit.Framework.TestCaseSourceAttribute.GetTestCaseSource(IMethodInfo method) in C:\src\nunit\nunit\src\NUnitFramework\framework\Attributes\TestCaseSourceAttribute.cs:line 263 at NUnit.Framework.TestCaseSourceAttribute.GetTestCasesFor(IMethodInfo method) in C:\src\nunit\nunit\src\NUnitFramework\framework\Attributes\TestCaseSourceAttribute.cs:line 170 --TypeInitializationException --IndexOutOfRangeException at nCrunch.TestRuntime.DotNetCore.SharedMemoryExecutionDataRecorder.MarkCoverageOfClass(Int32 componentMappingId, Int32 classIndex) at Exclaimer.Applications.ComodoProxy.WebApi.Models.ExclaimerOrderNumber..ctor(String prefix, CertificateType type, Guid id) in C:\Users\nick.hall\Source\Repos\tcps\src\Exclaimer.Applications.ComodoProxy.WebApi\Models\ExclaimerOrderNumber.cs:line 0 at Exclaimer.Applications.ComodoProxy.WebApi.Tests.ExclaimerOrderNumberTests..cctor() in C:\Users\nick.hall\Source\Repos\tcps\src\Exclaimer.Applications.ComodoProxy.WebApi.Tests\ExclaimerOrderNumberTests.cs:line 23 I've observed the following about the issue: -
- The affected tests are always based on use of the TestCaseSource attribute
- There seems to be a random factor - usually at least one test will blow up in the manner described; sometimes ALL of them do. Test failures vary between about one and 60.
- I have also sporadically seen an analysis failure reported by NCrunch which suggests it has encountered an AcessViolationException: -
An error occurred while analysing this project after it was built: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'Exclaimer.Applications.TenantCertificates.UnitTests.Diagnostics.CertificateRequestOperationUnitTests' threw an exception. ---> System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at nCrunch.TestRuntime.SharedExecutionMap.MarkTestLineExecutionTime(Int32 lineMarkerIndex, UInt32 tickCount) at nCrunch.TestRuntime.SharedMemoryExecutionDataRecorder.MarkTestLineExecutionTime(Int32 componentMappingId, Int32 lineMarkerIndex, UInt32 tickCount) at nCrunch.TestRuntime.TestCoverageEventListener.NCrunchExitMethod(Int32 componentId, Int32& existingCoverageMarkerIndex, UInt32 existingTickCount) at Exclaimer.Applications.TenantCertificates.UnitTests.Diagnostics.CertificateRequestOperationUnitTests..cctor() in C:\Users\nick.hall\Source\Repos\tcps\src\Exclaimer.Applications.TenantCerts.UnitTests\Diagnostics\CertificateRequestOperationUnitTests.cs:line 48 --- End of inner exception stack trace --- at Exclaimer.Applications.TenantCertificates.UnitTests.Diagnostics.CertificateRequestOperationUnitTests.get_CompletedTestCaseDatas() --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index) at NUnit.Framework.TestCaseSourceAttribute.GetTestCaseSource(IMethodInfo method) in C:\src\nunit\nunit\src\NUnitFramework\framework\Attributes\TestCaseSourceAttribute.cs:line 268 at NUnit.Framework.TestCaseSourceAttribute.GetTestCasesFor(IMethodInfo method) in C:\src\nunit\nunit\src\NUnitFramework\framework\Attributes\TestCaseSourceAttribute.cs:line 173 at NUnit.Framework.TestCaseSourceAttribute.<BuildFrom>d__22.MoveNext() in C:\src\nunit\nunit\src\NUnitFramework\framework\Attributes\TestCaseSourceAttribute.cs:line 139 at NUnit.Framework.Internal.Builders.DefaultTestCaseBuilder.BuildFrom(IMethodInfo method, Test parentSuite) in C:\src\nunit\nunit\src\NUnitFramework\framework\Internal\Builders\DefaultTestCaseBuilder.cs:line 144 at NUnit.Framework.Internal.Builders.NUnitTestFixtureBuilder.AddTestCasesToFixture(TestFixture fixture) in C:\src\nunit\nunit\src\NUnitFramework\framework\Internal\Builders\NUnitTestFixtureBuilder.cs:line 183 at NUnit.Framework.Internal.Builders.NUnitTestFixtureBuilder.BuildFrom(ITypeInfo typeInfo, ITestFixtureData testFixtureData) in C:\src\nunit\nunit\src\NUnitFramework\framework\Internal\Builders\NUnitTestFixtureBuilder.cs:line 156 at NUnit.Framework.TestFixtureAttribute.<BuildFrom>d__48.MoveNext() in C:\src\nunit\nunit\src\NUnitFramework\framework\Attributes\TestFixtureAttribute.cs:line 227 at NUnit.Framework.Internal.Builders.DefaultSuiteBuilder.BuildFrom(ITypeInfo typeInfo) in C:\src\nunit\nunit\src\NUnitFramework\framework\Internal\Builders\DefaultSuiteBuilder.cs:line 80 at NUnit.Framework.Api.DefaultTestAssemblyBuilder.GetFixtures(Assembly assembly, IList names) in C:\src\nunit\nunit\src\NUnitFramework\framework\Api\DefaultTestAssemblyBuilder.cs:line 208 at NUnit.Framework.Api.DefaultTestAssemblyBuilder.Build(Assembly assembly, String assemblyPath, IDictionary`2 options) in C:\src\nunit\nunit\src\NUnitFramework\framework\Api\DefaultTestAssemblyBuilder.cs:line 170 at NUnit.Framework.Api.DefaultTestAssemblyBuilder.Build(Assembly assembly, IDictionary`2 options) in C:\src\nunit\nunit\src\NUnitFramework\framework\Api\DefaultTestAssemblyBuilder.cs:line 85 at NUnit.Framework.Api.NUnitTestAssemblyRunner.Load(Assembly assembly, IDictionary`2 settings) in C:\src\nunit\nunit\src\NUnitFramework\framework\Api\NUnitTestAssemblyRunner.cs:line 174 at NUnit.Framework.Api.FrameworkController.LoadTests() in C:\src\nunit\nunit\src\NUnitFramework\framework\Api\FrameworkController.cs:line 201 at NUnit.Framework.Api.FrameworkController.LoadTests(ICallbackEventHandler handler) in C:\src\nunit\nunit\src\NUnitFramework\framework\Api\FrameworkController.cs:line 321 at NUnit.Framework.Api.FrameworkController.LoadTestsAction..ctor(FrameworkController controller, Object handler) in C:\src\nunit\nunit\src\NUnitFramework\framework\Api\FrameworkController.cs:line 502 --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, Object[] args) at nCrunch.Module.NUnit3.Integration.FrameworkController.LoadTests(INUnit3CallbackHandler handler) at nCrunch.Module.NUnit3.Integration.NUnit3FrameworkInteractor.<>c__DisplayClass8_0.<prepareFramework>b__0() at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity) at nCrunch.Common.PerformanceTracking.PerfTracker.TryTrackActivity(String name, Action activity) at nCrunch.Module.NUnit3.Integration.NUnit3FrameworkInteractor.prepareFramework(DynamicProxy[] dynamicProxies) at nCrunch.Module.NUnit3.Integration.NUnit3FrameworkInteractor..ctor(ReflectedAssembly assembly, IList`1 referencedAssemblyFilePaths, ComponentUniqueName testComponentUniqueName, DynamicProxy[] dynamicProxies) at nCrunch.Module.NUnit3.Integration.NUnit3FrameworkRuntimeEnvironment.FindFrameworkTestsInAssembly(ReflectedAssembly assembly, FilePath assemblyFilePath, IList`1 referencedAssemblyFilePaths, ComponentUniqueName testComponentUniqueName, PlatformType platformType, DynamicProxy[] dynamicProxies) at nCrunch.TestExecution.TestFinder..() at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity) at nCrunch.TestExecution.TestFinder..() at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity) at nCrunch.TestExecution.TestFinder.FindTestsForFrameworks(ReflectedAssembly assembly, FilePath assemblyFilePath, IList`1 referencedAssemblyFilePaths, DescribedTestFrameworkDiscoverer[] describedDiscoverers, ComponentUniqueName testComponentUniqueName, PlatformType platformType, DynamicProxy[] dynamicProxies) at nCrunch.TestExecution.RemoteTaskRunner.AnalyseAssembly(DescribedTestFrameworkDiscoverer[] applicableFrameworks, ComponentUniqueName testComponentUniqueName, PerfTracker perfTracker)
Please let me know if I can provide any further information or assist in the diagnosis of this issue. Nick Hall
|