2

我正在开发Visual Studio调试器可视化工具。它运行良好,但后来(意外)它被打破。我无法弄清楚它为什么会发生,因为我没有改变任何重要的东西。Visual Studio中的StackOverflowException DebuggerVisualizer

所以现在我得到An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll

这里是我的代码:

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

这里是后visualizerHost.ShowVisualizer()调用堆栈跟踪:重复[Native to Managed 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.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 

块连续造成StackOverflowException

有没有人有关于这个问题的想法?

+0

因此,代码,你有没有找到解决的办法? –

+0

不,我找不到解决方案 – levanovd

回答

0

你莫名其妙地创建了一个递归循环,但我不能看到它,你已经张贴

+1

请注意,递归循环在mscorlib.dll中 – levanovd