Ayende @ Rahien

Hi!
My name is Oren Eini
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:

ayende@ayende.com

+972 52-548-6969

, @ Q c

Posts: 18 | Comments: 87

filter by tags archive

How to find the stack trace for data binding?

time to read 1 min | 61 words

This is a rather special request, I’ll admit. For reasons of my own, I need to find the method(s) called to actually performed data binding in WPF & WinForms.

I have an elegant solution, which is too large to include in this blog post, but I’ll say that it doesn’t involves reflector at all.

Can you figure it out?


Comments

configurator

Throwing an exception and looking at its stack trace?

Andres

Dynamics?

Paulo Quicoli

Maybe, using some AOP you can log those methods for further use.

Harry M

I have discovered a truly marvelous method to find the methods used in databinding, in WPF or Winforms. This margin is too narrow to contain it.

Lars Hundertwasser

This sounds like "Fermat's Last Theorem" :). Sure hope the outcome will be different.

Hugo

Use a "debug" converter, which does nothing but return the value passed in, and set a breakpoint in the "Convert" method?

Samuel Jack

Put breakpoints in the get and set methods of properties that are databound, then look at the stack trace in Visual Studio.

For bonus points, enable .Net Framework source stepping and you can step through the databinding engine.

Alex Simkin

@Samuel Jack Yep. That's how I do it too.

Daniel Hoelbling

Dynamic Proxy Interceptor with a Breakpoint in it? ;)

greetings Daniel

Leon Breedt

Trace points and printing of $CALLSTACK?

Dathan

Two of my three approaches were already mentioned above:

1) Breakpoint in the property getter/setter;

2) Throw an exception in the property getter/setter;

Also, you could use the profiling API, but I don't think that counts as an "elegant solution."

For WinForms, you could probably also attach Format and/or Parse listeners to the Binding, and break/throw inside the appropriate methods. There's no guarantee that the call to Format/Parse is going to be made within the specific call stack that you're hoping to find, though.

Comment preview

Comments have been closed on this topic.

FUTURE POSTS

  1. Buffer allocation strategies: A possible solution - about one day from now
  2. Buffer allocation strategies: Explaining the solution - 3 days from now
  3. Buffer allocation strategies: Bad usage patterns - 4 days from now
  4. The useless text book algorithms - 5 days from now
  5. Find the bug: The concurrent memory buster - 6 days from now

There are posts all the way to Sep 11, 2015

RECENT SERIES

  1. Find the bug (5):
    20 Apr 2011 - Why do I get a Null Reference Exception?
  2. Production postmortem (10):
    03 Sep 2015 - The industry at large
  3. What is new in RavenDB 3.5 (7):
    12 Aug 2015 - Monitoring support
  4. Career planning (6):
    24 Jul 2015 - The immortal choices aren't
View all series

Syndication

Main feed Feed Stats
Comments feed   Comments Feed Stats