c# - How to find list of events using Debugger (VS Professional 2012)? -
okay, can't find help question , stackoverflow doesn't seem have either, or didn't know how (please right me, if i'm wrong , close question).
in program, have grid has few events definded in code:
public grid _grid = new grid(); _grid.mouseleftbuttondown += new mousebuttoneventhandler(mymethod); //and few more events... now during programme run, saw weird behaviour can come events, set breakpoint , stopped programme utilize debugger.
is there list can find somewhere lists defined events of fellow member _grid can check no unwanted events have not yet been removed?
update 2
unfortunately, events in wpf (i.e. on uielement) implemented manually implementing add/remove means event fellow member can on left hand side of -= or += operator (i.e. can't "read"). internals such each event "delegated" collection of events , collection contains elements assigned events (e.g. if there's single mouseleftbuttondownevent += somehandler; collection of events have 1 entry. unfortunately, collection of events stores represent handler internal construction have able instantiate query collection. unable instantiate instance of construction (routedeventhandlerinfo, fwiw) in order query collection (uielement.eventhandlersstore._entries, fwiw). e.g. if you, query handler particular event such in quickwatch window:
grid.eventhandlersstore._entries[ new routedeventhandlerinfo(uielement.mouseleftbuttondownevent, false)] but, debugger not allow invoke internal constructor.
there isn't lists just events. can see members of instance in debugger (watch, quickwatch, etc.) , events have distinct icon. can expand each 1 of these see method assigned event. example:
as can see, myevent has been "assigned" method t_myevent particular instance.
update: if have more 1 event handler assigned event, debugger show lastly assigned method in top-level of event in quick watch. see all methods assigned, you'll need drill-down invocation list. example:
.. shows both t_myevent , t_myevent2 in invocation list myevent. if hace no handlers, value myevent null.
c# wpf debugging events visual-studio-2012
No comments:
Post a Comment