如何在 VS 中而不是 JIT 调试器中进行调试?
更新:通过菜单导航到进程:DEBUG / Attach Process / iexplore.exe
显示“自动:Silverlight 代码”。即VS 2010已经附加到该过程中。为什么不进入调试视图?
我的笔记本电脑上出现令人沮丧的调试行为,我想修复它。我正在关注名为 Silverlight TV 46:我的 WCF 服务出了什么问题?
在我的计算机上,我注意到在 RIA 服务中放入 throw new ArithmeticException() 会导致即时调试器介入(这是一件坏事 - 我想要 VS)。我可以在 throw new ArithmeticExpression() 行上放置一个断点,VS 将像平常一样停止。按 F10,我仍然启动即时调试器。
在 Yvor 的计算机(上面第 8 章链接中的演示者)上,Visual Studio 调试器启动,而不是即时调试器-时间一。我做错了什么?之前安装的 Redgate Reflector 是否会导致此问题(现在已消失)。
错误: Visual Studio 即时调试器 代码:4004 类别:托管运行时错误 消息:System.Reflection.TargetInvocationException:操作过程中发生异常,导致结果无效。
检查...
可能的调试器:
New instance of MS VS 2010,
New instance of VS 2008.
- [选中] 将当前选择的调试器设置为默认调试器。
[未选中]手动选择调试引擎
操作:点击“是”。
第二个错误:
无法附加到崩溃的进程。调试器已附加。
我花了几个小时寻找解决这个问题的方法。
浏览器为IE9/Silverlight 4。
UPDATE: navigating to the process via menu:DEBUG / Attach Process / iexplore.exe
shows "Automatic: Silverlight code". i.e. VS 2010 already attached to the process. Why doesn't it go to debug view?
I have a frustrating debug behaviour going on on my laptop which I'd like to fix. I was following along with the demo called Silverlight TV 46: What's Wrong with my WCF Service?
On my computer, I noticed that putting throw new ArithmeticException()
in the RIA service causes the just-in-time debugger to get involved (a bad thing -- I want VS). I can put a break point on the the throw new ArithmeticExpression()
line, and VS stops as it normally does. Press F10, and I still get the just-in-time debugger kicking in.
On Yvor's computer (the presenter in the Ch 8 link above), the visual studio debugger kicks in instead of the just-in-time one. What am I doing wrong? Could having Redgate Reflector installed previously have caused this (it is gone now).
ERROR:
Visual Studio Just-In-Time Debugger
Code: 4004
Category: ManagedRuntimeError
Message: System.Reflection.TargetInvocationException: An exception occurred during the operation, making the result invalid.Check ...
Possible Debuggers:
New instance of MS VS 2010,
New instance of VS 2008.
- [checked] Set currently selected debugger as the default.
[unchecked] Manually choose the debugging engines
Action: Hit Yes.
2nd ERROR:
Unable to attach to the crashing process. A debugger is already attached.
I've spent several hours looking for a way to solve this.
Browser is IE9 / Silverlight 4.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以前,我开始直接通过 VS2010 环境启动 silverlight 应用程序...但后来决定(再次)获得更多的部署合规性。
http://msdn.microsoft.com/en-us/ Library/cc838267(VS.95).aspx
在底部,他们提到从控制面板/VS2010进行修复。就是这么做的。等了很长时间,煮了咖啡,做了别的事情。终于完成了。问题仍然存在。包含此步骤是为了防止修复是累积的(使用这些东西一段时间后您会变得迷信)。
然后我删除了 zap 文件,将启动页面从 html 切换为 aspx 页面。将 aspx 连接到 xap (它没有指向 /debug/ 文件夹)。 [注意:看起来您可以通过 Silverlight 项目/构建/输出路径删除调试:将 Bin\Debug\ 替换为 Bin。对于 Silverlight,我感觉相对 Uri 路径应该与您的 html/aspx 文件相匹配,无论您处于调试还是发布状态。
调试再次有效!
.html 停止调试了吗?随意检查发现,相同的 javascript 内容会启动 Silverlight。表面上看起来是一样的。嗯。我想并非如此。
...对于那些仍然有问题的人来说,这里有一些额外的事情需要注意(我也可以列出它们
虽然它们在我的脑海中是新鲜的)。
项目/属性/Web/调试器:我现在只检查了Silverlight。 ASP.Net 不再被检查。 (不确定这是否会影响我现阶段的结果)
确保您的 Web 项目指向项目/属性/Silverlight 应用程序中的 silverlight 项目。这可确保将 silverlight 项目的二进制“xap”复制到网站/Web 应用程序内的文件夹中。注意:点击添加按钮会显示目标文件夹(应该是 ClientBin)。
您的构建配置将添加一个额外的子文件夹,例如调试。
确保您的 .aspx 或 .html 文件具有正确的路径。对我来说,我只是包含了 .ClientBin/debug/ 文件夹。我认为这不适合部署,所以我稍后会寻找更好的方法。
[X] 禁用脚本调试。
[X] 禁用脚本调试(其他)
[ ] 显示有关脚本错误的通知
[ ] 显示友好的 HTTP 错误消息
再次不确定这些后续设置是否会产生影响。
最后,有件事我有时会忘记。请务必检查“调试 VS2010”/“异常”/“公共语言运行时”。这提高了捕获异常的能力。
Previously, I started starting the silverlight app directly via the VS2010 environment... but then decided to get more deployment compliant (again).
http://msdn.microsoft.com/en-us/library/cc838267(VS.95).aspx
Down the bottom they mention repairing from control panel / VS2010. Did that. Waited for ages, made coffee, did something else. Finally complete. Problem sill there. Included this step just-in-case the fix is cumulative (you get superstitious after a while with these things).
I then deleted zap files, switched startup page from html to the aspx one. Wired aspx to the xap (it wasn't pointing to the /debug/ folder). [note: looks like you can remove the debug via Silverlight Project / build / Output path: Replace Bin\Debug\ with Bin. With Silverlight I feel that the relative Uri path should match up to your html / aspx files no matter what -- wheather you are in Debug or Release.
debugging works again!
Did .html stop debugging? Casual inspection reveals the same javascript stuff firing up Silverlight. On the surface it looks the same. hmmm. I guess it isn't.
... here are a few extra things to look at for those who still have issues (I may as well list them
while they are fresh in my mind).
project / properties / Web / Debuggers: I now only have Silverlight checked. ASP.Net is not checked any more. (Not sure if this influences my result at this stage)
make sure your web project points to the silverlight project in project / properties / Silverlight Applications. This ensures that the silverlight project's binary "xap" is copied to a folder within the Web Site / Web App. Note: hitting the add button reveals a destination folder (should be ClientBin).
Your build configuration will add an additional sub foler e.g. debug.
Make sure your .aspx or .html files have the right path. For me, I just included the .ClientBin/debug/ folder. I don't think this is deploy friendly, so I will search for a better way later.
[X] Disable script debugging.
[X] Disable script debugging (Other)
[ ] Display notification about a script error
[ ] Show friendly HTTP error message
Again, unsure if these later setting have an impact.
Lastly, there's something that I forget about sometimes. Be sure to check Debug VS2010 / Exceptions / Common language Runtime. This ups the ability to catch exceptions.
我也遇到了类似的问题,但是上面的方法并没有解决。但是,在不调试 (Ctrl-F5) 的情况下启动应用程序并触发异常将允许我选择从中启动应用程序的 Visual Studio 实例。令人惊讶的是,我得到了合理的堆栈跟踪并在几分钟内解决了问题。
I had a similar problem, but the above did not resolve it. However, starting the application without debugging (Ctrl-F5) and triggering the exception would allow me to select the Visual Studio instance that I started the application from. Amazingly, I got a sensible stack trace and resolve the problem within a few minutes.