2

从命令行运行单元测试时出现以下错误。这在 Windows 10 机器上运行良好,在 Windows 7 中失败。

dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover --logger "trx;LogFileName=unit_tests.xml" --configuration Release 

致命错误。System.AccessViolationException:试图读取或写入受保护的内存。这通常表明其他内存已损坏。在 System.Reflection.RuntimeAssembly.InternalLoad(System.Runtime.CompilerServices.ObjectHandleOnStack,System.Runtime.CompilerServices.ObjectHandleOnStack,System.Runtime.CompilerServices.StackCrawlMarkHandle,布尔,System.Runtime.CompilerServices.ObjectHandleOnStack,System.Runtime.CompilerServices.ObjectHandleOnStack ) 在 System.Reflection.RuntimeAssembly.InternalLoad(System.Reflection.AssemblyName, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, Boolean, System.Runtime.Loader.AssemblyLoadContext) 在 System.Reflection.Assembly.Load(System. Reflection.AssemblyName) 在 Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.TestPluginCache。2<System.String,System.__Canon>) at Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.TestPluginDiscoverer.GetTestExtensionsFromFiles[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.String[], System.Collections.Generic.Dictionary2<System.String,System.__Canon>) 在 Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.TestPluginDiscoverer.GetTestExtensionsInformation[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e] ,[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e] 在 Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.TestPluginCache.GetTestExtensions[System.__Canon, System.Private.CoreLib ,版本=6.0.0.0,文化=中性,PublicKeyToken=7cec85d7bea7798e],[System.__Canon,System.Private.CoreLib,版本=6.0.0.0,文化=中性,PublicKeyToken=7cec85d7bea7798e] 在 Microsoft.VisualStudio.TestPlatform.Common。 ExtensionFramework.TestPluginCache.DiscoverTestExtensions[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral,PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e] 在 Microsoft.VisualStudio.TestPlatform.Common.Hosting.TestRuntimeExtensionManager.Create(Microsoft.VisualStudio.TestPlatform .ObjectModel.Logging.IMessageLogger) 在 Microsoft.VisualStudio.TestPlatform.Common.Hosting.TestRuntimeProviderManager.get_Instance() 在 Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.TestEngine..ctor() 在 Microsoft.VisualStudio.TestPlatform.Client.TestPlatform.. ctor() 在 Microsoft.VisualStudio.TestPlatform.Client.TestPlatformFactory.GetTestPlatform() 在 Microsoft.VisualStudio.TestPlatform.CommandLine.TestPlatformHelpers.TestRequestManager..ctor() 在 Microsoft.VisualStudio.TestPlatform.CommandLine.TestPlatformHelpers.TestRequestManager.get_Instance()在 Microsoft.VisualStudio。TestPlatform.CommandLine.Processors.RunTestsArgumentProcessor+<>c.<get_Executor>b__6_0() at System.Lazy1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ViaFactory(System.Threading.LazyThreadSafetyMode) at System.Lazy1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ExecutionAndPublication(System.LazyHelper, Boolean) at System.Lazy 1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].CreateValue() at System.Lazy1[[System.__Canon, System. Private.CoreLib,版本=6.0.0.0,文化=中性,PublicKeyToken=7cec85d7bea7798e]].get_Value() 在 Microsoft.VisualStudio.TestPlatform.CommandLine.Processors.ArgumentProcessorFactory+<>c__DisplayClass20_0.b__0() 在 System.Lazy1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].CreateValue() at System.Lazy1 [[System.__Canon,System.Private.CoreLib,版本=6.0.0.0,Culture=neutral,PublicKeyToken=7cec85d7bea7798e]].get_Value() 在 Microsoft.VisualStudio.TestPlatform.CommandLine.Executor.GetArgumentProcessors(System.String[] , System.Collections.Generic.List`1<Microsoft.VisualStudio.TestPlatform.CommandLine.Processors.IArgumentProcessor> ByRef) 在 Microsoft.VisualStudio.TestPlatform.CommandLine.Executor.Execute(System.String[]) 在 Microsoft.VisualStudio.TestPlatform .CommandLine.Program.Main(System.String[]) C:\Users\loadbuilder.nuget\packages\coverlet.msbuild\3.1.2\build\coverlet.msbuild.targets(71,5):错误 MSB4044:“ Coverlet.MSbuild.Tasks.CoverageResultTask”任务没有为所需参数“InstrumenterState”指定值。

4

0 回答 0