Debugging in VS  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

Debugging in VS

Postby perry » Tue Mar 24, 2015 11:39 am

Hi,

I've been using VS2012 to debug my plugins by attaching to Jiwa.exe and it works perfectly.

However, it seems not working for some forms, so far I found 2.
- JiwaDebtorStatementsUI.MainForm
- JiwaCreditorChqPayUI.CreditorChqPay

It won't trigger my breakpoint at "SetupBeforeHandlers" nor "Setup" in FormPlugin class. However, as soon as I add JiwaDebtorsUI.frmDebtor to "Forms" in plugin maintenance, it then hits the breakpoint.

I also tried with surrogate project to launch Jiwa and it behaves the same way.
Perry Ma
S. Programmer
Lonicera Pty Ltd
http://www.lonicera.com.au
perry
Frequent Contributor
Frequent Contributor
 
Posts: 173
Joined: Mon Oct 27, 2008 2:26 pm
Topics Solved: 15

Re: Debugging in VS  Topic is solved

Postby Mike.Sheen » Tue Mar 24, 2015 11:50 am

Hi Perry,

I tried this with the debtor statements form and it worked for me.

Can you import the attached plugin, save and reload Jiwa then attach your VS to the running Jiwa.exe, open the debtor statements form and see if you hit the breakpoint I set.

Mike

Plugin Debug Test #1.xml
Sample Plugin
(31.06 KiB) Downloaded 471 times
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: Debugging in VS

Postby perry » Tue Mar 24, 2015 2:45 pm

Hi Mike,

Your example worked with System.Diagnostics.Debugger.Break().

It is bit strange as with other plugin I have done, I didn't have to have "System.Diagnostics.Debugger.Break()" in plugin code.
As soon as I attach my VS project to Jiwa.exe, debugger will just pickup the correct class file in my project as if Jiwa is using the same assembly (they do have the same namespace).

Anyway, all good as long as I can debug all my plugins in VS.
Perry Ma
S. Programmer
Lonicera Pty Ltd
http://www.lonicera.com.au
perry
Frequent Contributor
Frequent Contributor
 
Posts: 173
Joined: Mon Oct 27, 2008 2:26 pm
Topics Solved: 15

Re: Debugging in VS

Postby Mike.Sheen » Tue Mar 24, 2015 8:56 pm

Hi Perry,

I'm glad you managed to move on and get what you needed to done, but I'd like to get to the bottom of this to see if there is something we can do to improve.

Could you kindly post some steps to reproduce so I can try this out - if necessary provide a sample plugin or code snippet for us to work with.

Thanks,

Mike
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: Debugging in VS

Postby perry » Mon Mar 30, 2015 5:47 pm

Hi Mike,

Sorry, I just realized you replied to this topic...

I figured what the problem was,
If I attach VS to Jiwa.exe, it will load the class (the plugin assembly but not the class from my VS project as I said in my earlier post) under 2 conditions.
- if you have System.Diagnostics.Debugger.Break() or
- if code throws an unhandled exception
When this happens, I can set breakpoint in that class file and next time it will always stop at the same breakpoint (because assembly name is the same, unless you change plugin name).

The funny thing is, I usually only need to debug a plugin if it throws an error, so I never had to add System.Diagnostics.Debugger.Break() in my plugin code.
The plugin I needed to do was related to CreditorChqPay and Debtor Statement which I haven't yet wrote plugins for, so, I want to take a look at the object's properties before I start coding.
I couldn't figure out how to set breakpoint because I was setting breakpoint in my own project's class file.


The other thing I don't have time to prove/check is why my project breakpoints don't load when I use surrogate project. I do remember it was working (setting breakpoint in my project's class) if I launch Jiwa with surrogate project. Maybe I referenced to my own DLL inside plugin.


Anyway, for anyone who wants to debug plugin inside VS, I found it is much easier if you just use "attach to process" function in VS and have System.Diagnostics.Debugger.Break() in the plugin code.
Unless there is another easier way Mike didn't tell us :)

Regards,
Perry Ma
S. Programmer
Lonicera Pty Ltd
http://www.lonicera.com.au
perry
Frequent Contributor
Frequent Contributor
 
Posts: 173
Joined: Mon Oct 27, 2008 2:26 pm
Topics Solved: 15


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 4 guests