在调试会话中我第一次尝试显示可视化器时,它引发了该异常(出现在底部),我单击异常消息对话框上的“继续”并再次显示可视化器(通过单击“放大镜变量旁边的图标)。这是我拥有的简单可视化工具:
[assembly: DebuggerVisualizer(
typeof(TestVisualizer),
Target = typeof (string),
Description = "Test Visualizer")]
namespace VuTree {
public class TestVisualizer : DialogDebuggerVisualizer {
protected override void Show(IDialogVisualizerService svc, IVisualizerObjectProvider provider) {
var text = provider.GetObject() as string ?? "no object found...";
using (var form = new Form())
{
form.Text = text;
form.Size = new Size(400, 400);
svc.ShowDialog(form);
}
}
}
}
这是(部分)例外:
************** Exception Text **************
System.Runtime.InteropServices.COMException (0x8013134F): Object is in a zombie state. (Exception from HRESULT: 0x8013134F)
Server stack trace:
at Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.IPropertyProxyEESide.InitSourceDataProvider(IEEDataStorage& data)
at Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.ManagedShim.SafeProxyWrapper.InitSourceDataProvider()
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.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.DebuggerVisualizers.DebugViewerShim.ManagedShim.SafeProxyWrapper.InitSourceDataProvider()
at Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.ManagedShim.DelegatedHost.CreateViewer(IntPtr hwnd, HostServicesHelper hsh, SafeProxyWrapper proxy)
为什么会这样?如何解决?