SpecFlow 错误:Newtonsoft.Json.JsonSerializationException:运行测试时自引用循环错误

问题描述

我在安装了 Visual Studio 2019 的 M1 MacBook 上运行 Parallels。我已经安装了 SpecFlow 并设置了一个新项目(使用“SpecFlow Project”选项)。

在不做任何更改的情况下,我尝试运行创建的认计算器测试。我在日志中收到以下错误

2021-03-08T15:48:00.9438755+00:00;Thread#12;Error;Newtonsoft.Json.JsonSerializationException 在序列化过程中抛出:Newtonsoft.Json.JsonSerializationException:检测到类型为 'ManifestModule' 的属性的自引用循环System.Reflection.RuntimeModule'。路径“Summary.FrameworkErrorException.InnerException.TargetSite.Module.Assembly”。

我怀疑这可能是 M1 芯片 MacBook 与 SpecFlow 的兼容性问题(尽管在 Parallels 上运行)但想知道是否有人在运行 SpecFlow 功能文件时设法修复了此错误

这是完整的日志详细信息:

2021-03-08T15:47:58.3341220+00:00;VSTestExecutionThread;Info;SpecFlow+Runner execution started
2021-03-08T15:47:58.3348037+00:00;VSTestExecutionThread;Info;SpecFlow+Runner 3.7.3 in Framework netcore31 in x64 mode execution started
2021-03-08T15:47:58.3348321+00:00;VSTestExecutionThread;Info;TestAdapter Location: \\Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1\TechTalk.SpecRun.VisualStudio.TestAdapter.dll
2021-03-08T15:47:58.3387007+00:00;VSTestExecutionThread;Info;Current UserName: 'charlieseligman',MachineName: 'CHARLIESELI0D9D'
2021-03-08T15:47:58.3980081+00:00;VSTestExecutionThread;Info;SpecRun: running tests in \\Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1\DeleteProject.dll
2021-03-08T15:47:58.3987441+00:00;VSTestExecutionThread;Info;Output folder configured to "\\Mac\Home\Desktop\DeleteProject\TestResults" (default)
2021-03-08T15:47:58.4000208+00:00;VSTestExecutionThread;Info;Profile:
2021-03-08T15:47:58.4811167+00:00;VSTestExecutionThread;Info;Log file path: \\Mac\Home\Desktop\DeleteProject\TestResults\Unnamed project__2021-03-08T154758.log
2021-03-08T15:47:58.4915350+00:00;Thread#12;Info;Checking activation
2021-03-08T15:47:58.6828131+00:00;Thread#12;Info;Activated.
2021-03-08T15:47:58.6836331+00:00;Thread#12;Info;Activation check completed
2021-03-08T15:47:58.6840017+00:00;Thread#12;Info;Starting test run
2021-03-08T15:47:58.8609352+00:00;Thread#12;Info;discovering target: Default
2021-03-08T15:47:58.8926851+00:00;Thread#12;Info;discovering tests from assembly: \\Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1\DeleteProject.dll
2021-03-08T15:47:59.5200560+00:00;Thread#12;Info;discovered tests from assembly: \\Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1\DeleteProject.dll
2021-03-08T15:47:59.5241342+00:00:Test Suite Dump
2021-03-08T15:47:59.5268815+00:00:#0: Unnamed project/ -
2021-03-08T15:47:59.5269775+00:00:#1: Default -
2021-03-08T15:47:59.5269991+00:00:#2: DeleteProject -
2021-03-08T15:47:59.5270078+00:00:#3: Calculator -
2021-03-08T15:47:59.5295451+00:00:#4: Add two numbers - TestAssembly:DeleteProject/Feature:Calculator/Scenario:Add+two+numbers
2021-03-08T15:47:59.5296593+00:00:End: Test Suite Dump
2021-03-08T15:47:59.6521231+00:00:Thread#0:Scheduler: get next test for thread 0
2021-03-08T15:47:59.6555193+00:00:Thread#:Scheduler: testitem #4 from normal test queue
2021-03-08T15:47:59.6556918+00:00:Thread#0:Scheduler: considering testitem #4 for thread 0
2021-03-08T15:47:59.6612955+00:00:Thread#0:TestItem#4:testItemmatchesCurrentTestThread:UnSpecific
2021-03-08T15:47:59.6613414+00:00:Thread#0:TestItem#4:runsOnOneOtherThreadSpecific:False
2021-03-08T15:47:59.6613711+00:00:Thread#0:TestItem#4:runsOnOneOtherThreadUnspecific:False
2021-03-08T15:47:59.6614160+00:00:Thread#0:Scheduler: using testitem #4 for thread 0
2021-03-08T15:47:59.6626078+00:00:Thread#0:Scheduler: Test #4 is scheduled for thread
2021-03-08T15:47:59.6679526+00:00:Thread#0:Scheduler: with testItemExecutionIndex 0
2021-03-08T15:47:59.6718810+00:00:Thread #0: creating new test thread executor for DeleteProject,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null (target: Default)
2021-03-08T15:47:59.6760463+00:00:Thread #0: Creating test assembly executor for execution model OutProc
2021-03-08T15:47:59.6764966+00:00:Thread #0: Creating test assembly executor for execution model OutProc
2021-03-08T15:47:59.6849249+00:00:Thread #0: using TechTalk.SpecRun.Framework.Execution.OutOfProc.StreamJsonRPC.OutOfProcesstestAssemblyExecutorHost to execute tests
2021-03-08T15:47:59.6893257+00:00:starting Out Of Process Executor
2021-03-08T15:47:59.7161361+00:00:Assembly resolving Microsoft.VisualStudio.Validation,Version=15.3.0.0,PublicKeyToken=b03f5f7f11d50a3a
2021-03-08T15:47:59.7224767+00:00:[AssemblyCache] Trying to resolve 'Microsoft.VisualStudio.Validation' from .deps.json file
2021-03-08T15:47:59.7229450+00:00:[AssemblyCache] Could not resolve 'Microsoft.VisualStudio.Validation' from .deps.json
2021-03-08T15:47:59.7255695+00:00:[AssemblyCache] Trying to resolve 'Microsoft.VisualStudio.Validation' in folder '\\Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1'
2021-03-08T15:47:59.7265530+00:00:[AssemblyCache] Trying to resolve 'Microsoft.VisualStudio.Validation' to '\\Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1\Microsoft.VisualStudio.Validation.dll'
2021-03-08T15:47:59.7268647+00:00:[AssemblyCache] Trying to resolve 'Microsoft.VisualStudio.Validation' to '\\Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1\Microsoft.VisualStudio.Validation.exe'
2021-03-08T15:47:59.7270451+00:00:[AssemblyCache] Could not resolve 'Microsoft.VisualStudio.Validation' in folder '\\Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1'
2021-03-08T15:47:59.7283263+00:00:TargetFramework: .NETCoreApp,Version=v3.1
2021-03-08T15:47:59.7296133+00:00:Tfm: netcoreapp3.1
2021-03-08T15:47:59.7296544+00:00:[AssemblyCache] Trying to resolve 'Microsoft.VisualStudio.Validation' in folder '\\Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1\SpecFlowPlusRunner\netcoreapp3.1'
2021-03-08T15:47:59.7296666+00:00:[AssemblyCache] Trying to resolve 'Microsoft.VisualStudio.Validation' to '\\Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1\SpecFlowPlusRunner\netcoreapp3.1\Microsoft.VisualStudio.Validation.dll'
2021-03-08T15:47:59.7299356+00:00:[AssemblyCache] Found file '\\Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1\SpecFlowPlusRunner\netcoreapp3.1\Microsoft.VisualStudio.Validation.dll' for assembly 'Microsoft.VisualStudio.Validation'
2021-03-08T15:47:59.7557146+00:00:[AssemblyCache] Resolved 'Microsoft.VisualStudio.Validation' to \\Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1\SpecFlowPlusRunner\netcoreapp3.1\Microsoft.VisualStudio.Validation.dll
2021-03-08T15:47:59.7575144+00:00:Starting callback TCP Rpc server
2021-03-08T15:47:59.7936118+00:00:Asynchronously starting background TCP Rpc Server on port 32768
2021-03-08T15:47:59.7942457+00:00:Started callback TCP Rpc server on port 32768
2021-03-08T15:47:59.7942692+00:00:Starting logger TCP Rpc server
2021-03-08T15:47:59.7965978+00:00:Asynchronously starting background TCP Rpc Server on port 32769
2021-03-08T15:47:59.7966752+00:00:Started logger TCP Rpc server on port 32769
2021-03-08T15:48:00.0019442+00:00:Executing test executor at 'dotnet' 'exec "Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1\SpecFlowPlusRunner\netcoreapp3.1\TechTalk.SpecRun.Framework.Executor.anycpu.netcoreapp3_1.dll" --remoteRunnerPid 9372 --uniqueId "2021-03-08T154758" --outputFolder "\\Mac\Home\Desktop\DeleteProject\TestResults" --callbackPort 32768 --loggerPort 32769' in 'Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1'
2021-03-08T15:48:00.0890899+00:00:System.ComponentModel.Win32Exception (267): The directory name is invalid.
at System.Diagnostics.Process.StartWithCreateProcess(processstartinfo startInfo)
at System.Diagnostics.Process.Start()
at TechTalk.SpecRun.Framework.Execution.OutOfProc.OutProcExecutorManager.StartProcess(ExecutorProcessInfo executorProcessInfo)
at TechTalk.SpecRun.VisualStudio.TestAdapter.VsOutProcExecutorManager.StartProcess(ExecutorProcessInfo executorProcessInfo)
at TechTalk.SpecRun.Framework.Execution.OutOfProc.StreamJsonRPC.OutOfProcesstestAssemblyExecutorHost.Initialize(Int32 threadId,ITestExecutionManager executionManager,IAssemblyReference testAssembly,ITestLogger currentLogger,String testAssemblyFullPath,String testAssemblyConfigFilePath,TestExecutionConfiguration testExecutionConfiguration,String target)
2021-03-08T15:48:00.0989111+00:00:Assembly resolving System.Diagnostics.Process.resources,Version=4.2.2.0,Culture=en-US,PublicKeyToken=b03f5f7f11d50a3a
2021-03-08T15:48:00.0989667+00:00:[AssemblyCache] Trying to resolve 'System.Diagnostics.Process.resources' from .deps.json file
2021-03-08T15:48:00.0989796+00:00:[AssemblyCache] Could not resolve 'System.Diagnostics.Process.resources' from .deps.json
2021-03-08T15:48:00.0989941+00:00:[AssemblyCache] Trying to resolve 'System.Diagnostics.Process.resources' in folder '\\Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1'
2021-03-08T15:48:00.0990299+00:00:[AssemblyCache] Trying to resolve 'System.Diagnostics.Process.resources' to '\\Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1\System.Diagnostics.Process.resources.dll'
2021-03-08T15:48:00.0991227+00:00:[AssemblyCache] Trying to resolve 'System.Diagnostics.Process.resources' to '\\Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1\System.Diagnostics.Process.resources.exe'
2021-03-08T15:48:00.0992084+00:00:[AssemblyCache] Could not resolve 'System.Diagnostics.Process.resources' in folder '\\Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1'
2021-03-08T15:48:00.0992221+00:00:TargetFramework: .NETCoreApp,Version=v3.1
2021-03-08T15:48:00.0993228+00:00:Tfm: netcoreapp3.1
2021-03-08T15:48:00.0993370+00:00:[AssemblyCache] Trying to resolve 'System.Diagnostics.Process.resources' in folder '\\Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1\SpecFlowPlusRunner\netcoreapp3.1'
2021-03-08T15:48:00.0993488+00:00:[AssemblyCache] Trying to resolve 'System.Diagnostics.Process.resources' to '\\Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1\SpecFlowPlusRunner\netcoreapp3.1\System.Diagnostics.Process.resources.dll'
2021-03-08T15:48:00.0994465+00:00:[AssemblyCache] Trying to resolve 'System.Diagnostics.Process.resources' to '\\Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1\SpecFlowPlusRunner\netcoreapp3.1\System.Diagnostics.Process.resources.exe'
2021-03-08T15:48:00.0995310+00:00:[AssemblyCache] Could not resolve 'System.Diagnostics.Process.resources' in folder '\\Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1\SpecFlowPlusRunner\netcoreapp3.1'
2021-03-08T15:48:00.1196236+00:00:[AssemblyCache] Trying to resolve 'System.Diagnostics.Process.resources' in folder 'C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\3.1.12'
2021-03-08T15:48:00.1196945+00:00:[AssemblyCache] Trying to resolve 'System.Diagnostics.Process.resources' to 'C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\3.1.12\System.Diagnostics.Process.resources.dll'
2021-03-08T15:48:00.1197614+00:00:[AssemblyCache] Trying to resolve 'System.Diagnostics.Process.resources' to 'C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\3.1.12\System.Diagnostics.Process.resources.exe'
2021-03-08T15:48:00.1197866+00:00:[AssemblyCache] Could not resolve 'System.Diagnostics.Process.resources' in folder 'C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\3.1.12'
2021-03-08T15:48:00.1199493+00:00:[AssemblyCache] Trying to resolve 'System.Diagnostics.Process.resources' in folder 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.12'
2021-03-08T15:48:00.1199606+00:00:[AssemblyCache] Trying to resolve 'System.Diagnostics.Process.resources' to 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.12\System.Diagnostics.Process.resources.dll'
2021-03-08T15:48:00.1199957+00:00:[AssemblyCache] Trying to resolve 'System.Diagnostics.Process.resources' to 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.12\System.Diagnostics.Process.resources.exe'
2021-03-08T15:48:00.1200353+00:00:[AssemblyCache] Could not resolve 'System.Diagnostics.Process.resources' in folder 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.12'
2021-03-08T15:48:00.1201472+00:00:[AssemblyCache] Trying to resolve 'System.Diagnostics.Process.resources' in folder 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\3.1.12'
2021-03-08T15:48:00.1201569+00:00:[AssemblyCache] Trying to resolve 'System.Diagnostics.Process.resources' to 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\3.1.12\System.Diagnostics.Process.resources.dll'
2021-03-08T15:48:00.1202102+00:00:[AssemblyCache] Trying to resolve 'System.Diagnostics.Process.resources' to 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\3.1.12\System.Diagnostics.Process.resources.exe'
2021-03-08T15:48:00.1202314+00:00:[AssemblyCache] Could not resolve 'System.Diagnostics.Process.resources' in folder 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\3.1.12'
2021-03-08T15:48:00.1222160+00:00:Assembly resolving System.Diagnostics.Process.resources,Culture=en,PublicKeyToken=b03f5f7f11d50a3a
2021-03-08T15:48:00.1289902+00:00:Thread #0: Error while unpacking executor: System.ComponentModel.Win32Exception (267): The directory name is invalid.
at System.Diagnostics.Process.StartWithCreateProcess(processstartinfo startInfo)
at System.Diagnostics.Process.Start()
at TechTalk.SpecRun.Framework.Execution.OutOfProc.OutProcExecutorManager.StartProcess(ExecutorProcessInfo executorProcessInfo)
at TechTalk.SpecRun.VisualStudio.TestAdapter.VsOutProcExecutorManager.StartProcess(ExecutorProcessInfo executorProcessInfo)
at TechTalk.SpecRun.Framework.Execution.OutOfProc.StreamJsonRPC.OutOfProcesstestAssemblyExecutorHost.Initialize(Int32 threadId,String target)
at TechTalk.SpecRun.Framework.TestThread.InitializeExecutor(ITestAssemblyExecutor executor,DeploymentContext deploymentContext,IAssemblyReference testAssembly)
2021-03-08T15:48:00.1296638+00:00:test thread #0 error: System.ComponentModel.Win32Exception (267): The directory name is invalid.
at TechTalk.SpecRun.Framework.TestThread.UnpackTestThreadExecutorInfoResult(IResult`1 testThreadExecutorInfoResult)
at TechTalk.SpecRun.Framework.TestThread.InitializeTestThreadExecutor(IAssemblyReference testAssembly,ExecutionModelSettings executionModelSettings,String testTarget)
at TechTalk.SpecRun.Framework.TestThread.GetThreadExecutor(IAssemblyReference testAssembly,String testTarget)
at TechTalk.SpecRun.Framework.TestThread.GetThreadExecutorForTestItem(TestItem testItem)
at TechTalk.SpecRun.Framework.TestThread.RunNonEmptyTestSuite(CancellationToken cancellationToken,TestThreadState testThreadState)
at TechTalk.SpecRun.Framework.TestThread.Run(ITestExecutionManager executionManagerForRun,CancellationToken cancellationToken)
at TechTalk.SpecRun.Framework.asynctestThreadRunner.RunSync(TestExecutionManager executionManager,CancellationToken cancellationToken)
2021-03-08T15:48:00.1326278+00:00:test thread error: TechTalk.SpecRun.Framework.SpecRunException: At least one test thread aborted.
---> System.ComponentModel.Win32Exception (267): The directory name is invalid.
at TechTalk.SpecRun.Framework.TestThread.UnpackTestThreadExecutorInfoResult(IResult`1 testThreadExecutorInfoResult)
at TechTalk.SpecRun.Framework.TestThread.InitializeTestThreadExecutor(IAssemblyReference testAssembly,CancellationToken cancellationToken)
--- End of inner exception stack trace ---
2021-03-08T15:48:00.1508426+00:00:Thread#-1: Test #4/0 is started on thread #-1
2021-03-08T15:48:00.1790503+00:00:Thread#-1: Test #4/0 is finished on thread #-1 as Skipped within 0.0224131 seconds
2021-03-08T15:48:00.3852668+00:00:Thread#-1:Scheduler: get next test for thread -1
2021-03-08T15:48:00.3853524+00:00:Thread#:Scheduler: at the end of normal test queue
2021-03-08T15:48:00.3853827+00:00:Thread#-1:Scheduler: enumerator for thread is at end
2021-03-08T15:48:00.4373596+00:00:Assembly resolving System.Net.sockets.resources,PublicKeyToken=b03f5f7f11d50a3a
2021-03-08T15:48:00.4374363+00:00:[AssemblyCache] Trying to resolve 'System.Net.sockets.resources' from .deps.json file
2021-03-08T15:48:00.4374531+00:00:[AssemblyCache] Could not resolve 'System.Net.sockets.resources' from .deps.json
2021-03-08T15:48:00.4374750+00:00:[AssemblyCache] Trying to resolve 'System.Net.sockets.resources' in folder '\\Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1'
2021-03-08T15:48:00.4374847+00:00:[AssemblyCache] Trying to resolve 'System.Net.sockets.resources' to '\\Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1\System.Net.sockets.resources.dll'
2021-03-08T15:48:00.4376016+00:00:[AssemblyCache] Trying to resolve 'System.Net.sockets.resources' to '\\Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1\System.Net.sockets.resources.exe'
2021-03-08T15:48:00.4376783+00:00:[AssemblyCache] Could not resolve 'System.Net.sockets.resources' in folder '\\Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1'
2021-03-08T15:48:00.4376925+00:00:TargetFramework: .NETCoreApp,Version=v3.1
2021-03-08T15:48:00.4377566+00:00:Tfm: netcoreapp3.1
2021-03-08T15:48:00.4377677+00:00:[AssemblyCache] Trying to resolve 'System.Net.sockets.resources' in folder '\\Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1\SpecFlowPlusRunner\netcoreapp3.1'
2021-03-08T15:48:00.4377771+00:00:[AssemblyCache] Trying to resolve 'System.Net.sockets.resources' to '\\Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1\SpecFlowPlusRunner\netcoreapp3.1\System.Net.sockets.resources.dll'
2021-03-08T15:48:00.4378523+00:00:[AssemblyCache] Trying to resolve 'System.Net.sockets.resources' to '\\Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1\SpecFlowPlusRunner\netcoreapp3.1\System.Net.sockets.resources.exe'
2021-03-08T15:48:00.4379174+00:00:[AssemblyCache] Could not resolve 'System.Net.sockets.resources' in folder '\\Mac\Home\Desktop\DeleteProject\bin\Debug\netcoreapp3.1\SpecFlowPlusRunner\netcoreapp3.1'
2021-03-08T15:48:00.4389215+00:00:[AssemblyCache] Trying to resolve 'System.Net.sockets.resources' in folder 'C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\3.1.12'
2021-03-08T15:48:00.4389474+00:00:[AssemblyCache] Trying to resolve 'System.Net.sockets.resources' to 'C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\3.1.12\System.Net.sockets.resources.dll'
2021-03-08T15:48:00.4389873+00:00:[AssemblyCache] Trying to resolve 'System.Net.sockets.resources' to 'C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\3.1.12\System.Net.sockets.resources.exe'
2021-03-08T15:48:00.4390265+00:00:[AssemblyCache] Could not resolve 'System.Net.sockets.resources' in folder 'C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\3.1.12'
2021-03-08T15:48:00.4390935+00:00:[AssemblyCache] Trying to resolve 'System.Net.sockets.resources' in folder 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.12'
2021-03-08T15:48:00.4391047+00:00:[AssemblyCache] Trying to resolve 'System.Net.sockets.resources' to 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.12\System.Net.sockets.resources.dll'
2021-03-08T15:48:00.4391285+00:00:[AssemblyCache] Trying to resolve 'System.Net.sockets.resources' to 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.12\System.Net.sockets.resources.exe'
2021-03-08T15:48:00.4391453+00:00:[AssemblyCache] Could not resolve 'System.Net.sockets.resources' in folder 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.12'
2021-03-08T15:48:00.4392083+00:00:[AssemblyCache] Trying to resolve 'System.Net.sockets.resources' in folder 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\3.1.12'
2021-03-08T15:48:00.4392152+00:00:[AssemblyCache] Trying to resolve 'System.Net.sockets.resources' to 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\3.1.12\System.Net.sockets.resources.dll'
2021-03-08T15:48:00.4392381+00:00:[AssemblyCache] Trying to resolve 'System.Net.sockets.resources' to 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\3.1.12\System.Net.sockets.resources.exe'
2021-03-08T15:48:00.4392567+00:00:[AssemblyCache] Could not resolve 'System.Net.sockets.resources' in folder 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\3.1.12'
2021-03-08T15:48:00.4399068+00:00:Assembly resolving System.Net.sockets.resources,PublicKeyToken=b03f5f7f11d50a3a
2021-03-08T15:48:00.4437138+00:00;Thread#12;Info;test run finished
2021-03-08T15:48:00.4449837+00:00;Thread#12;Info;publishing test results
2021-03-08T15:48:00.4458952+00:00;Thread#12;Info;Not publishing results.
2021-03-08T15:48:00.4465061+00:00;Thread#12;Info;test results published
2021-03-08T15:48:00.4466864+00:00;Thread#12;Info;generating reports
2021-03-08T15:48:00.9438755+00:00;Thread#12;Error;Newtonsoft.Json.JsonSerializationException thrown during serialization: Newtonsoft.Json.JsonSerializationException: Self referencing loop detected for property 'ManifestModule' with type 'System.Reflection.RuntimeModule'. Path 'Summary.FrameworkErrorException.InnerException.TargetSite.Module.Assembly'.
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CheckForCircularReference(JsonWriter writer,Object value,JsonProperty property,JsonContract contract,JsonContainerContract containerContract,JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer,JsonContainerContract contract,JsonProperty member,JsonContract& memberContract,Object& memberValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer,JsonObjectContract contract,JsonContainerContract collectionContract,JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer,JsonContract valueContract,JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer,JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter,Type objectType)
at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter,Type objectType)
at Newtonsoft.Json.JsonSerializer.Serialize(JsonWriter jsonWriter,Object value)
at Newtonsoft.Json.JsonSerializer.Serialize(TextWriter textWriter,Object value)
at TechTalk.SpecRun.Framework.Services.JsonNetSerializer.Serialize[T](T value,FSharpOption`1 target)
2021-03-08T15:48:00.9452640+00:00;Thread#12;Error;Failed writing reporting data to file "C:\Users\charlieseligman\AppData\Local\Temp\4f907254-0990-467d-8b7f-bacc30f9aac6".
2021-03-08T15:48:00.9568638+00:00;Thread#12;Info;Failed generating reports
2021-03-08T15:48:00.9703745+00:00:Total: 1
2021-03-08T15:48:00.9736996+00:00:Succeeded: 0
2021-03-08T15:48:00.9742691+00:00:Ignored: 0
2021-03-08T15:48:00.9747124+00:00:Pending: 0
2021-03-08T15:48:00.9747483+00:00:Skipped: 1
2021-03-08T15:48:00.9752032+00:00:Failed: 0
2021-03-08T15:48:00.9772309+00:00;VSTestExecutionThread;Info;Adding attachments to VSTest
========== End of log file ==========

解决方法

我刚刚在 https://support.specflow.org/hc/en-us/community/posts/360014907078-Newtonsoft-Json-JsonSerializationException-Self-referencing-loop-error?page=1#community_comment_360004000098

回答了最初的问题

它看起来像我们这边的一个错误。作为解决方法,您可以禁用报告生成。

为此,将其放入您的 srProfile 文件

<Report disable="true"/>

来自https://docs.specflow.org/projects/specflow-runner/en/latest/Profile/Report.html#examples

,

我遇到了同样的问题,结果证明我创建的钩子是非静态的。钩子方法必须是静态的。

[BeforeFeature(Order = 0)]
public static void EmptyStorageFolder()
{
}