button executes, but not hitting break pont in buttons event handler.

Jan 19, 2009 at 12:15 PM
... one aspect that i find mysterious...

with NUNIT and in debug mode debuging my WPF app via the NUNIT test, using white,
I click on a button - i see in the gui that it is clearly clicked and does it does the work it should.

But i have a break point in the click handler....
And I don't hit this break point! 
Even though i am certain the code does execute.

I hit othewise all breakpoints in the code of the actual unit test itself.

What is the reason for not hitting the break-point in the buttons event handler??
Is there a setting that forgot somewhere?

Regards,
Paul S.
Coordinator
Jan 26, 2009 at 2:51 PM
are you trying to debug the AUT running the test process in debug mode?
Jan 27, 2009 at 5:10 PM
Edited Jan 27, 2009 at 5:10 PM
Yep, vivek, i wrote a nunit test to do AUT.
The project with my unit tests start up in Debug mode (to answer your question).

It's a class project so when starting in debug it starts the GUI version of NUNIT.
And i then click the unit test shown in the NUNIT GUI to start it.

I hit all break points in the unit test itself.  But if i do Button.Click() via Whites Core.UIItems.Button, i do not hit any breakpoint in the buttons event handler.  The break point is also yellow with a question mark in it, indicating that it is inactive.

If i put a break point in the NUNIT test before i do Core.UIItems.Button.Click() and then moreover attach the debugger to the WPF process that was started up via White (application = Core.Application.Launch(path)), then in notice that the break point in the event handler becomes active (red).

But then i get an exception when doing  Core.UIItems.Button.Click() 

System.InvalidOperationException crossed a native/managed boundary
  Message="Das Zielelement kann keinen Fokus erhalten."
translation: "the target element cannot recieve focus."
  Source="PresentationCore"
  StackTrace:
       bei MS.Internal.Automation.ElementUtil.Invoke(AutomationPeer peer, DispatcherOperationCallback work, Object arg)
       bei MS.Internal.Automation.ElementProxy.SetFocus()
  InnerException:

You'd be welcome to illucidate.

Thanks,
Paul
Coordinator
Jan 31, 2009 at 11:25 AM
is it possible for you to send some sample code?