上周在 TechEd 了解 IntelliTrace 后,我今天早上安装了 Visual Studio 2012 Ultimate RC。我们目前使用 VS 2010 Professional,因此使用 2012 RC 是我测试 IntelliTrace 的唯一简单选择。
我打开了 VS 2012 Ultimate RC 并打开了一个用 VS 2010 编写的 MVC 3 项目。如果我将它设置为“仅 IntelliTrace 事件”,IntelliTrace 运行良好。但是,如果我将其设置为“IntelliTrace 事件和调用信息”,则在启动调试器时会出现异常:
System.Reflection.TargetInvocationException was unhandled
HResult=-2146232828
Message=Exception has been thrown by the target of an invocation.
Source=mscorlib
StackTrace:
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at System.Web.HttpApplication.InvokeMethodWithAssert(MethodInfo method, Int32 paramCount, Object eventSource, EventArgs eventArgs)
at System.Web.HttpApplication.ProcessSpecialRequest(HttpContext context, MethodInfo method, Int32 paramCount, Object eventSource, EventArgs eventArgs, HttpSessionState session)
at System.Web.HttpApplicationFactory.FireApplicationOnStart(HttpContext context)
at System.Web.HttpApplicationFactory.EnsureAppStartCalled(HttpContext context)
at System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context)
at System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
at System.Web.HttpRuntime.ProcessRequestNow(HttpWorkerRequest wr)
at System.Web.HttpRuntime.ProcessRequestNoDemand(HttpWorkerRequest wr)
at System.Web.HttpRuntime.ProcessRequest(HttpWorkerRequest wr)
at Microsoft.VisualStudio.WebHost.Request.Process()
at Microsoft.VisualStudio.WebHost.Host.ProcessRequest(Connection conn)
at Microsoft.VisualStudio.WebHost.Host.ProcessRequest(Connection conn)
at Microsoft.VisualStudio.WebHost.Server.OnSocketAccept(Object acceptedSocket)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
InnerException: System.AccessViolationException
HResult=-2147467261
Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
StackTrace:
InnerException:
问题似乎出在 Microsoft.VisualStudio.WebHost.Server.OnSocketAccept 的函数条目中。我不知道这是什么。
我玩了一些,发现:
- 如果我打开在 VS 2010 中创建的 Web 表单项目,则不会出现此问题。
- 如果我在 VS 2012 RC 中创建新的 MVC 3 项目,则不会出现此问题。
- 仅当我打开在 VS 2010 中创建的 MVC 3 项目时才会出现此问题。
除了在 VS 2012 RC 中创建一个新项目并复制所有代码之外,我不知道如何尝试解决这个问题,我不想为我们拥有的每个项目都这样做。我不知道这可能是 VS 2012 RC 中的错误。我还要注意,我还收到一条错误消息,提示“无法找到或打开 PDB 文件”,它与 IntelliTrace 输出中的最后一个事件一起出现,但不确定它是否已连接。任何帮助都是极好的。