.net - 当单元测试调试停止时,Moles 崩溃

标签 .net crash moles pex pex-and-moles

我在 Visual Studio 2010 SP1(Windows 7 Enterprise 64 位,所有更新均通过 Windows Update 安装)中使用 Pex 和 Moles Power Tools 0.94.51023.0 64 位 (en_visual_studio_2010_pex_0.94.51023.0_power_tools_x64_598803.exe)。项目是.NET 2.0,测试在设置中明确设置的 32 位模式下运行。 运行时一切正常,没有错误发生。但是当我在 Debug模式下运行测试并在完成之前停止时,Moles 崩溃了:

Microsoft.Moles.VsHost stopped working
Problem signature:
  Problem Event Name:   CLR20r3
  Problem Signature 01: microsoft.moles.vshost.x86.exe
  Problem Signature 02: 0.94.0.0
  Problem Signature 03: 4cc31915
  Problem Signature 04: System.Runtime.Remoting
  Problem Signature 05: 4.0.0.0
  Problem Signature 06: 4ba1df86
  Problem Signature 07: e5
  Problem Signature 08: c9
  Problem Signature 09: System.Runtime.Remoting.Remoting
  OS Version:   6.1.7601.2.1.0.256.4
  Locale ID:    1033
  Additional Information 1: 0a9e
  Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
  Additional Information 3: 0a9e
  Additional Information 4: 0a9e372d3b4ad19135b953a78882e789

附加调试器并获得更详细的信息:

The test adapter 'MolesAgentAdapter' threw an exception while running test 'My_Test_Method_Name'. Failed to read from an IPC Port: The pipe has been ended.

调用堆栈:

Server stack trace: 
   at System.Runtime.Remoting.Channels.Ipc.IpcPort.Connect(String portName, Boolean secure, TokenImpersonationLevel impersonationLevel, Int32 timeout)
   at System.Runtime.Remoting.Channels.Ipc.ConnectionCache.GetConnection(String portName, Boolean secure, TokenImpersonationLevel level, Int32 timeout)
   at System.Runtime.Remoting.Channels.Ipc.IpcClientTransportSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ITransportHeaders& responseHeaders, Stream& responseStream)
   at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Microsoft.VisualStudio.TestTools.Execution.IResultSink.AddResult(TestMessage testMessage)
   at Microsoft.Moles.VsHost.Host.SafeResultSink.AddResult(TestMessage testMessage)
   at Microsoft.Moles.VsHost.RunResultSyncLogger.eventLogSource_LogHandler(LogEventArgs e)
   at Microsoft.ExtendedReflection.Logging.EventLog.LogUnfiltered(LogEventArgs args)
   at Microsoft.ExtendedReflection.Logging.EventLog.LogErrorFromException(Exception ex, String wikiTopic, String category, String message)
   at Microsoft.Moles.VsHost.Host.MolesHostAdapter.AsyncRunTests()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

当测试运行到最后时,没有发生崩溃。已尝试重新安装 .NET Framework 和 Moles,但没有成功解决此问题。有什么想法导致/如何解决这个问题吗?显示的代理和 IPC 连接非常奇怪。提前致谢。

最佳答案

问题在项目升级期间得到解决,导致 Moles 被逐步淘汰并代之以 Fakes。

关于.net - 当单元测试调试停止时,Moles 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20699760/

相关文章:

c# - MultipartFormDataContent.Add String Content 正在向名称添加回车符/换行符

c# - 使用 WinSCP .NET 程序集从 FTP 服务器下载除特定文件夹之外的所有文件

iphone - 在 UITableView 中展开部分,当展开多个部分时会崩溃

c# - 单元测试遗留代码 : limits of "extract and override" vs JustMock/TypeMock/moles?

.net - Microsoft Fakes 和 .Net 4.0

asp.net-mvc - Moles 无法与 MVC3 (System.Web.Mvc.dll) 一起使用

c# - 有没有一种方法可以在任一字段发生更改时触发远程验证属性?

c# - 如何在不链接的情况下从 .NET 使用命令行 Matlab?

android - 使用 Glide 库时崩溃

Android 应用程序仅在运行 android 4.4.2 的 google nexus 7 中崩溃 - kitkat