Test Run fails with "An exception occurred while invoking executor 'executor://mstestadapter/v2': Type ... is not marked as serializable."
解决方案:
- Mark type as
Serializable
. - Don't add the type to
CallContext
. - Set
DisableAppDomain
value to true in runsettings (supported by MSTest v2, NUnit and XUnit).
Using a runsettings file User can specify a runsettings
file to configure test run. For example:
> vstest.console.exe --settings:test.runsettings test.dll
> dotnet test -s test.runsettings
- Using command line runsettings parameters Various elements of a
runsettings
file can also specified as command line parameters directly. For example, consider followingrunsettings
:
<RunSettings>
<RunConfiguration>
<DisableAppDomain>True</DisableAppDomain>
</RunConfiguration>
</RunSettings>