如何在 C#PresentationFramework.dll 中设置断点?

发布于 2024-08-18 06:44:42 字数 746 浏览 8 评论 0原文

这可能是盲目的,但是,我该如何在PresentationFramework.dll中的以下内部静态方法内设置断点?

System.Windows.Documents.TextEditorTyping._ShowCursor()

我遇到了与 Joe,我使用 TextBox 控件和包含 ItemsControl 的 Popup 制作自定义自动完成文本框。当我将焦点放在文本框和以 StaysOpen="False" 显示的弹出窗口中,并键入一些字符时,鼠标指针将被隐藏(我相信是通过调用 System.Windows.Documents.TextEditorTyping.HideCursor )。它通常在鼠标移动时重新显示,但是似乎弹出窗口在检查是否应该隐藏时处理此事件,因此当您在窗口中移动指针时,指针保持隐藏状态。

有一个怪癖,在第一次按键时,指针消失然后立即重新出现,然后在第二次按键时,指针保持隐藏状态。这表明有东西正在调用 _ShowCursor(),我很想知道是什么。因此这篇文章以及设置上述断点的愿望。我如何设置该断点?

关于我的实际问题,指针一旦移动就保持隐藏状态,我希望通过自己模拟 StaysOpen="False" 而不阻止鼠标移动事件来解决它,或者自己触发鼠标移动事件以使指针重新出现。对此的任何其他提示表示赞赏。

This might be a shot in the dark, but, how would I go about setting a breakpoint inside the following internal static method in PresentationFramework.dll?

System.Windows.Documents.TextEditorTyping._ShowCursor()

I've run into a very similar situation to Joe, where I am making a custom auto-complete textbox using a TextBox control and a Popup which contains an ItemsControl. When I have the focus in the text box and the popup shown with StaysOpen="False", and type some characters, the mouse pointer is hidden (through a call to System.Windows.Documents.TextEditorTyping.HideCursor I believe). It is normally re-shown on mouse move, however it appears that the popup handles this event while it is checking whether it should hide or not, so the pointer stays hidden as you move it around the window.

There is a quirk, where on the first key press, the pointer disappears then instantly reappears, then on the second key press, the pointer stays hidden. This suggests that something is calling _ShowCursor(), and I am interested to know what. Hence this post, and the desire to set the breakpoint described above. How do I set that breakpoint?

Regarding my actual problem, the pointer staying hidden once it moves, I hope to solve it either by emulating StaysOpen="False" myself without blocking mouse move events, or to fire mouse move events myself to cause the pointer to reappear. Any other tips on this appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

余厌 2024-08-25 06:44:42

虽然您无法使用库存框架执行此操作(没有可用的调试符号),但是您可以使用 Reflector Pro 来实现这种欺骗: http://www.red-gate.com/messageboard/viewforum.php?f=109

Reflector Pro 会将 WPF 程序集反汇编为 .cs 源文件,并动态生成它自己的调试 PDB - 然后您可以使用 Visual Studio 单步执行演示框架程序集(并设置断点)

祝您好运!

While you cannot do this with the stock framework (no debug symbols available,) you can get this kind of trickery working with Reflector Pro: http://www.red-gate.com/messageboard/viewforum.php?f=109

Reflector Pro will disassemble the WPF assemblies into .cs source files, and generate it's own debug PDB on the fly - you then then single-step with Visual Studio through the Presentation Framework assembly (and set breakpoints)

good luck!

撕心裂肺的伤痛 2024-08-25 06:44:42

我不得不建议你在源代码文件中设置断点。它可以从参考源获得,我强烈推荐 Mass Downloader工具来获取它。如果您将其安装到 c:\ReferenceSource,则您需要的源代码文件将位于 c:\ReferenceSource\dd\wpf\src\FrameWork\System\Windows\Documents\TextEditorTyping.cs。

参考源相对于反编译源的一大优势是它包含源代码注释。并非所有源代码都可用,但 WPF 的很大一部分是可用的。

约翰·罗宾斯的 安装说明非常好。我唯一遇到的问题是由于之前使用了 Microsoft 调试符号服务器提供的调试符号。我必须手动删除符号缓存中参考源中也可用的 .pdb 文件。

I have to recommend you set the breakpoint in the source code file. It is available from the Reference Source, I very strongly recommend the Mass Downloader tool to get it. If you installed it to c:\ReferenceSource then the source code file you need will be available at c:\ReferenceSource\dd\wpf\src\FrameWork\System\Windows\Documents\TextEditorTyping.cs.

One of the great advantages of the reference source over decompiled source is that it contains source code comments. Not all of the source code is available, but very large chunks of WPF are.

John Robbins' install instructions are very good. The only hiccup I had was induced by previously having used the debugging symbols available from the Microsoft debug symbol server. I had to delete the .pdb files that are also available from the reference source from the symbol cache by hand.

蹲在坟头点根烟 2024-08-25 06:44:42

这可能有点棘手,但可以通过以下步骤完成。

  1. 从调试选项菜单中禁用“仅我的代码”
  2. 打开断点窗口并选择在函数处中断
  3. 如果函数运行,请键入全名

It can be a bit tricky but it can be done in the following steps.

  1. Disable "just my code" from the debugging options menu
  2. Open the breakpoints window and slect break at function
  3. Type the full name if the funciom
我们只是彼此的过ke 2024-08-25 06:44:42

对于其他遇到此问题的人,我是这样做的(VS2015):

下载并安装 JetBrains dotPeek

将 dotPeek 作为符号服务器运行

如下所述: https://www.jetbrains.com/help/decompiler/2016.1/Using_product_as_a_Symbol_Server.html

您可能还必须删除/重命名已下载的错误版本的PresentationFramework.pdb,如上面链接中的“可能的问题和解决方案”所述

For other that run in to this problem here is how I did it (VS2015):

Downloaded and installed JetBrains dotPeek

run dotPeek as a symbol server

As explained here: https://www.jetbrains.com/help/decompiler/2016.1/Using_product_as_a_Symbol_Server.html

you probably also have to delete/rename the already downloaded wrong version of PresentationFramework.pdb as explained under "Possible Problems and Solutions" in above link

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文