This is a C# web services project in Visual Studio that has existed for a number of years. Today it started throwing an exception upon startup within Visual Studio, but only when the debugger is attached.
这是Visual Studio中的C#Web服务项目,已存在多年。今天它开始在Visual Studio中启动时抛出异常,但只有在连接调试器时才会抛出异常。
The exception is:
例外是:
System.*Exception was unhandled
Message: An unhandled exception of type 'System.*Exception' occurred in mscorlib.dll
This is Visual Studio 2013 Update 3.
这是Visual Studio 2013 Update 3。
Relevant section of stack trace:
堆栈跟踪的相关部分:
System.Runtime.Serialization.dll!System.Runtime.Serialization.Json.JsonDataContract.WriteJsonValue(System.Runtime.Serialization.XmlWriterDelegator jsonWriter, object obj, System.Runtime.Serialization.Json.XmlObjectSerializerWriteContextComplexJson context, System.RuntimeTypeHandle declaredTypeHandle) Unknown
System.Runtime.Serialization.dll!System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(System.Runtime.Serialization.XmlWriterDelegator xmlWriter, object obj, bool isDeclaredType, bool writeXsiType, int declaredTypeID, System.RuntimeTypeHandle declaredTypeHandle) Unknown
System.Runtime.Serialization.dll!System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerializeReference(System.Runtime.Serialization.XmlWriterDelegator xmlWriter, object obj, bool isDeclaredType, bool writeXsiType, int declaredTypeID, System.RuntimeTypeHandle declaredTypeHandle) Unknown
[Lightweight Function]
System.Runtime.Serialization.dll!System.Runtime.Serialization.Json.JsonDataContract.WriteJsonValue(System.Runtime.Serialization.XmlWriterDelegator jsonWriter, object obj, System.Runtime.Serialization.Json.XmlObjectSerializerWriteContextComplexJson context, System.RuntimeTypeHandle declaredTypeHandle) Unknown
System.Runtime.Serialization.dll!System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeAndVerifyType(System.Runtime.Serialization.DataContract dataContract, System.Runtime.Serialization.XmlWriterDelegator xmlWriter, object obj, bool verifyKnownType, System.RuntimeTypeHandle declaredTypeHandle, System.Type declaredType) Unknown
System.Runtime.Serialization.dll!System.Runtime.Serialization.Json.XmlObjectSerializerWriteContextComplexJson.SerializeWithXsiType(System.Runtime.Serialization.XmlWriterDelegator xmlWriter, object obj, System.RuntimeTypeHandle objectTypeHandle, System.Type objectType, int declaredTypeID, System.RuntimeTypeHandle declaredTypeHandle, System.Type declaredType) Unknown
System.Runtime.Serialization.dll!System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(System.Runtime.Serialization.XmlWriterDelegator xmlWriter, object obj, bool isDeclaredType, bool writeXsiType, int declaredTypeID, System.RuntimeTypeHandle declaredTypeHandle) Unknown
System.Runtime.Serialization.dll!System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerializeReference(System.Runtime.Serialization.XmlWriterDelegator xmlWriter, object obj, bool isDeclaredType, bool writeXsiType, int declaredTypeID, System.RuntimeTypeHandle declaredTypeHandle) Unknown
[Lightweight Function]
System.Runtime.Serialization.dll!System.Runtime.Serialization.Json.JsonClassDataContract.WriteJsonValueCore(System.Runtime.Serialization.XmlWriterDelegator jsonWriter, object obj, System.Runtime.Serialization.Json.XmlObjectSerializerWriteContextComplexJson context, System.RuntimeTypeHandle declaredTypeHandle) Unknown
System.Runtime.Serialization.dll!System.Runtime.Serialization.Json.JsonDataContract.WriteJsonValue(System.Runtime.Serialization.XmlWriterDelegator jsonWriter, object obj, System.Runtime.Serialization.Json.XmlObjectSerializerWriteContextComplexJson context, System.RuntimeTypeHandle declaredTypeHandle) Unknown
System.Runtime.Serialization.dll!System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithoutXsiType(System.Runtime.Serialization.DataContract dataContract, System.Runtime.Serialization.XmlWriterDelegator xmlWriter, object obj, System.RuntimeTypeHandle declaredTypeHandle) Unknown
System.Runtime.Serialization.dll!System.Runtime.Serialization.Json.DataContractJsonSerializer.InternalWriteObjectContent(System.Runtime.Serialization.XmlWriterDelegator writer, object graph) Unknown
System.Runtime.Serialization.dll!System.Runtime.Serialization.Json.DataContractJsonSerializer.InternalWriteObject(System.Runtime.Serialization.XmlWriterDelegator writer, object graph) Unknown
System.Runtime.Serialization.dll!System.Runtime.Serialization.XmlObjectSerializer.WriteObjectHandleExceptions(System.Runtime.Serialization.XmlWriterDelegator writer, object graph, System.Runtime.Serialization.DataContractResolver dataContractResolver) Unknown
System.Runtime.Serialization.dll!System.Runtime.Serialization.Json.DataContractJsonSerializer.WriteObject(System.Xml.XmlDictionaryWriter writer, object graph) Unknown
System.Runtime.Serialization.dll!System.Runtime.Serialization.Json.DataContractJsonSerializer.WriteObject(System.IO.Stream stream, object graph) Unknown
Microsoft.VisualStudio.Web.PageInspector.Runtime.dll!Microsoft.VisualStudio.Web.PageInspector.Runtime.Tracing.JsonUtility.Serialize(object data, System.IO.Stream outputStream) Unknown
Microsoft.VisualStudio.Web.PageInspector.Runtime.dll!Microsoft.VisualStudio.Web.PageInspector.Runtime.Tracing.RequestDataHttpHandler.System.Web.IHttpHandler.ProcessRequest(System.Web.HttpContext context) Unknown
System.Web.dll!System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() Unknown
System.Web.dll!System.Web.HttpApplication.ExecuteStep(System.Web.HttpApplication.IExecutionStep step, ref bool completedSynchronously) Unknown
System.Web.dll!System.Web.HttpApplication.PipelineStepManager.ResumeSteps(System.Exception error) Unknown
System.Web.dll!System.Web.HttpApplication.BeginProcessRequestNotification(System.Web.HttpContext context, System.AsyncCallback cb) Unknown
System.Web.dll!System.Web.HttpRuntime.ProcessRequestNotificationPrivate(System.Web.Hosting.IIS7WorkerRequest wr, System.Web.HttpContext context) Unknown
System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(System.IntPtr rootedObjectsPointer, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags) Unknown
System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(System.IntPtr rootedObjectsPointer, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags) Unknown
[Native to Managed Transition]
[Managed to Native Transition]
System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(System.IntPtr rootedObjectsPointer, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags) Unknown
System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(System.IntPtr rootedObjectsPointer, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags) Unknown
[AppDomain Transition]
2 个解决方案
#1
16
The following entry added to the web.config prevents this problem:
添加到web.config的以下条目可防止此问题:
<appSettings>
<!-- Turn-off VS2013 BrowserLink feature which causes issues when Debugging -->
<add key="vs:EnableBrowserLink" value="false" />
#2
0
The answer by redcalx is correct.
redcalx的答案是正确的。
This problem still exists in the 'latest' version of Visual Studio (2015). I ran into it and thought, might as wel try it because I am totally out of ideas.
这个问题仍然存在于Visual Studio(2015)的“最新”版本中。我遇到它并想,不妨尝试一下,因为我完全没有想法。
Well, it worked, I am so grateful.
好吧,它很有效,我很感激。
Version information: Microsoft Visual Studio Enterprise 2015 Version 14.0.25425.01 Update 3 Microsoft .NET Framework Version 4.6.01586
版本信息:Microsoft Visual Studio Enterprise 2015版本14.0.25425.01更新3 Microsoft .NET Framework版本4.6.01586
Installed Version: Enterprise Architecture and Modeling Tools 00322-80000-00000-AA466 Microsoft Architecture and Modeling Tools
已安装版本:企业体系结构和建模工具00322-80000-00000-AA466 Microsoft体系结构和建模工具
Visual C# 2015 00322-80000-00000-AA466 Microsoft Visual C# 2015 ASP.NET and Web Tools 2015.1 (Beta8) 14.1.11107.0 ASP.NET and Web Tools 2015.1 (Beta8)
Visual C#2015 00322-80000-00000-AA466 Microsoft Visual C#2015 ASP.NET和Web工具2015.1(Beta8)14.1.11107.0 ASP.NET和Web工具2015.1(Beta8)
ASP.NET Web Frameworks and Tools 2012.2 4.1.41102.0
ASP.NET Web框架和工具2012.2 4.1.41102.0
ASP.NET Web Frameworks and Tools 2013 5.2.40314.0
ASP.NET Web框架和工具2013 5.2.40314.0
#1
16
The following entry added to the web.config prevents this problem:
添加到web.config的以下条目可防止此问题:
<appSettings>
<!-- Turn-off VS2013 BrowserLink feature which causes issues when Debugging -->
<add key="vs:EnableBrowserLink" value="false" />
#2
0
The answer by redcalx is correct.
redcalx的答案是正确的。
This problem still exists in the 'latest' version of Visual Studio (2015). I ran into it and thought, might as wel try it because I am totally out of ideas.
这个问题仍然存在于Visual Studio(2015)的“最新”版本中。我遇到它并想,不妨尝试一下,因为我完全没有想法。
Well, it worked, I am so grateful.
好吧,它很有效,我很感激。
Version information: Microsoft Visual Studio Enterprise 2015 Version 14.0.25425.01 Update 3 Microsoft .NET Framework Version 4.6.01586
版本信息:Microsoft Visual Studio Enterprise 2015版本14.0.25425.01更新3 Microsoft .NET Framework版本4.6.01586
Installed Version: Enterprise Architecture and Modeling Tools 00322-80000-00000-AA466 Microsoft Architecture and Modeling Tools
已安装版本:企业体系结构和建模工具00322-80000-00000-AA466 Microsoft体系结构和建模工具
Visual C# 2015 00322-80000-00000-AA466 Microsoft Visual C# 2015 ASP.NET and Web Tools 2015.1 (Beta8) 14.1.11107.0 ASP.NET and Web Tools 2015.1 (Beta8)
Visual C#2015 00322-80000-00000-AA466 Microsoft Visual C#2015 ASP.NET和Web工具2015.1(Beta8)14.1.11107.0 ASP.NET和Web工具2015.1(Beta8)
ASP.NET Web Frameworks and Tools 2012.2 4.1.41102.0
ASP.NET Web框架和工具2012.2 4.1.41102.0
ASP.NET Web Frameworks and Tools 2013 5.2.40314.0
ASP.NET Web框架和工具2013 5.2.40314.0