views:

385

answers:

3

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.

+3  A: 

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 presentationframework assembly (and set breakpoints)

good luck!

-Oisin

x0n
Debug symbols *are* available from the Microsoft debug symbol server. Better yet, the source code is available too.
Hans Passant
A: 

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
JaredPar
+1  A: 

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.

Hans Passant
are the WPF assemblies part of the shared source distro?
x0n
Shared Source is another animal, no WPF there. WPF source code is part of the Reference Source.
Hans Passant