2

我正在开发 Visual Studio 调试器可视化工具。它工作得很好,但后来(出乎意料地)它坏了。我不知道为什么会这样,因为我没有改变任何重要的东西。

所以现在我明白了An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll

这是我的代码:

var visualizerHost = new VisualizerDevelopmentHost(objectToVisualize, typeof(DebuggerSide));
visualizerHost.ShowVisualizer();

这是visualizerHost.ShowVisualizer()调用后的堆栈跟踪:

System.RuntimeTypeHandle.GetTypeByName(string name, bool throwOnError, bool ignoreCase, bool reflectionOnly, ref System.Threading.StackCrawlMark stackMark, System.IntPtr pPrivHostBinder, bool loadTypeFromPartialName) + 0x99 bytes   
System.RuntimeTypeHandle.GetTypeByName(string name, bool throwOnError, bool ignoreCase, bool reflectionOnly, ref System.Threading.StackCrawlMark stackMark, bool loadTypeFromPartialName) + 0x25 bytes  
System.Runtime.Remoting.RemotingServices.LoadClrTypeWithPartialBindFallback(string typeName, bool partialFallback) + 0x3b bytes 
System.Runtime.Remoting.RemotingServices.InternalGetTypeFromQualifiedTypeName(string qualifiedTypeName, bool partialFallback) + 0x4c bytes  
System.Runtime.Remoting.RemotingServices.GetType(object tp) + 0xce bytes    
System.Runtime.Serialization.SerializationInfo.AddValue(string name, object value) + 0x1d bytes 
System.Runtime.Remoting.Messaging.LogicalCallContext.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) + 0x145 bytes    
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(object obj, System.Runtime.Serialization.ISurrogateSelector surrogateSelector, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.Formatters.Binary.SerObjectInfoInit serObjectInfoInit, System.Runtime.Serialization.IFormatterConverter converter, System.Runtime.Serialization.Formatters.Binary.ObjectWriter objectWriter, System.Runtime.Serialization.SerializationBinder binder) + 0x31b bytes 
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(object obj, System.Runtime.Serialization.ISurrogateSelector surrogateSelector, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.Formatters.Binary.SerObjectInfoInit serObjectInfoInit, System.Runtime.Serialization.IFormatterConverter converter, System.Runtime.Serialization.Formatters.Binary.ObjectWriter objectWriter, System.Runtime.Serialization.SerializationBinder binder) + 0x10e bytes 
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(object graph, System.Runtime.Remoting.Messaging.Header[] inHeaders, System.Runtime.Serialization.Formatters.Binary.__BinaryWriter serWriter, bool fCheck) + 0x32e bytes   
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(System.IO.Stream serializationStream, object graph, System.Runtime.Remoting.Messaging.Header[] headers, bool fCheck) + 0x142 bytes 
System.Runtime.Remoting.Messaging.SmuggledMethodCallMessage.SmuggledMethodCallMessage(System.Runtime.Remoting.Messaging.IMethodCallMessage mcm) + 0x460 bytes   
System.Runtime.Remoting.Channels.CrossAppDomainSink.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage reqMsg = {System.Runtime.Remoting.Messaging.Message}) + 0x11d bytes   
System.Runtime.Remoting.Proxies.RemotingProxy.CallProcessMessage(System.Runtime.Remoting.Messaging.IMessageSink ms, System.Runtime.Remoting.Messaging.IMessage reqMsg, System.Runtime.Remoting.Contexts.ArrayWithSize proxySinks, System.Threading.Thread currentThread, System.Runtime.Remoting.Contexts.Context currentContext, bool bSkippingContextChain) + 0x8c bytes  
System.Runtime.Remoting.Proxies.RemotingProxy.InternalInvoke(System.Runtime.Remoting.Messaging.IMethodCallMessage reqMcmMsg, bool useDispatchMessage, int callType) + 0x22c bytes   
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(ref System.Runtime.Remoting.Proxies.MessageData msgData, int type) + 0x1f4 bytes    
Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.ManagedShim.DelegatedHost.HostResolver.ResolveRemoteAssembly(string fullAssemblyName = "nunit.core, Version=2.6.2.12296, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77") + 0x99 bytes 
Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.ManagedShim.DelegatedHost.HostResolver.ResolveName(string fullAssemblyName = "nunit.core, Version=2.6.2.12296, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77", bool noVersion = false, bool cacheOnly = false) + 0x94 bytes   
Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.AbstractAssemblyResolver.ResolveName(string fullAssemblyName = "nunit.core, Version=2.6.2.12296, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77", bool cacheOnly = false) + 0x53 bytes 
Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.AbstractAssemblyResolver.ResolveName(string fullAssemblyname = "nunit.core, Version=2.6.2.12296, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77") + 0x6e bytes 
Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.AbstractAssemblyResolver.ResolveHandler(object source = {System.AppDomain}, System.ResolveEventArgs resolveArgs = {System.ResolveEventArgs}) + 0x58 bytes    
System.AppDomain.OnAssemblyResolveEvent(System.Reflection.RuntimeAssembly assembly, string assemblyFullName) + 0xbc bytes   
[Native to Managed Transition]  
[Managed to Native Transition]  
System.RuntimeTypeHandle.GetTypeByName(string name, bool throwOnError, bool ignoreCase, bool reflectionOnly, ref System.Threading.StackCrawlMark stackMark, System.IntPtr pPrivHostBinder, bool loadTypeFromPartialName) + 0x99 bytes   
System.RuntimeTypeHandle.GetTypeByName(string name, bool throwOnError, bool ignoreCase, bool reflectionOnly, ref System.Threading.StackCrawlMark stackMark, bool loadTypeFromPartialName) + 0x25 bytes  
System.Runtime.Remoting.RemotingServices.LoadClrTypeWithPartialBindFallback(string typeName, bool partialFallback) + 0x3b bytes 
System.Runtime.Remoting.RemotingServices.InternalGetTypeFromQualifiedTypeName(string qualifiedTypeName, bool partialFallback) + 0x4c bytes  
System.Runtime.Remoting.RemotingServices.GetType(object tp) + 0xce bytes    
System.Runtime.Serialization.SerializationInfo.AddValue(string name, object value) + 0x1d bytes 
System.Runtime.Remoting.Messaging.LogicalCallContext.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) + 0x145 bytes    
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(object obj, System.Runtime.Serialization.ISurrogateSelector surrogateSelector, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.Formatters.Binary.SerObjectInfoInit serObjectInfoInit, System.Runtime.Serialization.IFormatterConverter converter, System.Runtime.Serialization.Formatters.Binary.ObjectWriter objectWriter, System.Runtime.Serialization.SerializationBinder binder) + 0x31b bytes 
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(object obj, System.Runtime.Serialization.ISurrogateSelector surrogateSelector, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.Formatters.Binary.SerObjectInfoInit serObjectInfoInit, System.Runtime.Serialization.IFormatterConverter converter, System.Runtime.Serialization.Formatters.Binary.ObjectWriter objectWriter, System.Runtime.Serialization.SerializationBinder binder) + 0x10e bytes 
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(object graph, System.Runtime.Remoting.Messaging.Header[] inHeaders, System.Runtime.Serialization.Formatters.Binary.__BinaryWriter serWriter, bool fCheck) + 0x32e bytes   
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(System.IO.Stream serializationStream, object graph, System.Runtime.Remoting.Messaging.Header[] headers, bool fCheck) + 0x142 bytes 
System.Runtime.Remoting.Messaging.SmuggledMethodCallMessage.SmuggledMethodCallMessage(System.Runtime.Remoting.Messaging.IMethodCallMessage mcm) + 0x460 bytes   
System.Runtime.Remoting.Channels.CrossAppDomainSink.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage reqMsg = {System.Runtime.Remoting.Messaging.Message}) + 0x11d bytes   
System.Runtime.Remoting.Proxies.RemotingProxy.CallProcessMessage(System.Runtime.Remoting.Messaging.IMessageSink ms, System.Runtime.Remoting.Messaging.IMessage reqMsg, System.Runtime.Remoting.Contexts.ArrayWithSize proxySinks, System.Threading.Thread currentThread, System.Runtime.Remoting.Contexts.Context currentContext, bool bSkippingContextChain) + 0x8c bytes  
System.Runtime.Remoting.Proxies.RemotingProxy.InternalInvoke(System.Runtime.Remoting.Messaging.IMethodCallMessage reqMcmMsg, bool useDispatchMessage, int callType) + 0x22c bytes   
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(ref System.Runtime.Remoting.Proxies.MessageData msgData, int type) + 0x1f4 bytes    
Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.ManagedShim.DelegatedHost.CreateViewer(System.IntPtr hwnd = 65552, Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.ManagedShim.HostServicesHelper hsh = {System.Runtime.Remoting.Proxies.__TransparentProxy}, Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.ManagedShim.SafeProxyWrapper proxy = {System.Runtime.Remoting.Proxies.__TransparentProxy}) + 0x198 bytes 
[Appdomain Transition]  
Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.ManagedShim.Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.IManagedViewerHost.CreateViewer(System.IntPtr hwnd = 65552, object hostServicesParam = null, Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.IPropertyProxyEESide proxy = {Microsoft.VisualStudio.DebuggerVisualizers.VisualizerDevelopmentHost.EEProxyImpl}) + 0x4df bytes    
Microsoft.VisualStudio.DebuggerVisualizers.VisualizerDevelopmentHost.EEProxyImpl.ShowVisualizer(System.IntPtr parentWindow = 65552) + 0x6c bytes    
Microsoft.VisualStudio.DebuggerVisualizers.VisualizerDevelopmentHost.ShowVisualizer(System.IntPtr parentHandle = 65552) + 0x77 bytes    
Microsoft.VisualStudio.DebuggerVisualizers.VisualizerDevelopmentHost.ShowVisualizer() + 0x41 bytes  

[Native to Managed Transition]连续不断地重复造成的阻塞StackOverflowException

有人对这个问题有想法吗?

4

1 回答 1

0

您以某种方式创建了一个递归循环,但我在您发布的代码中看不到它

于 2012-11-15T08:53:43.353 回答