Attached Debugger not working  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Attached Debugger not working

Postby sameermoin » Fri Sep 09, 2022 5:36 am

Hi,

I am working on a plugin to debug the issue. I am attaching the debugger using System.Diagnostics.Debugger.Launch(); but it's not working for me. Sometimes it triggers only on the first run of the scheduler service when it starts and after that, it stops working. I tried removing the existing database and recreating it. Even though I also reinstalled the visual studio, this is also not working.

I am using Visual Studio 2022 Enterprise edition.


Thanks
sameermoin
Regular Contributor
Regular Contributor
 
Posts: 75
Joined: Wed Jun 15, 2022 4:02 am
Topics Solved: 1

Re: Attached Debugger not working

Postby Mike.Sheen » Fri Sep 09, 2022 10:44 am

sameermoin wrote:I am working on a plugin to debug the issue. I am attaching the debugger using System.Diagnostics.Debugger.Launch(); but it's not working for me. Sometimes it triggers only on the first run of the scheduler service when it starts and after that, it stops working.


So it does work, just not all the time?

Try adding
Code: Select all
System.Diagnostics.Debugger.Break();
AFTER your line
Code: Select all
System.Diagnostics.Debugger.Launch();
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: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Attached Debugger not working

Postby SBarnes » Fri Sep 09, 2022 1:14 pm

One problem that can cause this is it depends who is logged onto the machine at the time, for example if there is another active user with Administration privileges quite often it can launch for the other user, one way around this is change the windows account the service is running under to the logged in user.

Like Mike also suggested use launch and break in tandem.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Attached Debugger not working

Postby sameermoin » Fri Sep 09, 2022 4:11 pm

Yes, it worked only for one time. Suppose I have a scheduler that runs every 10 mins named "something".

I have an if condition in the scheduler service Execute method.

if(Schedule.Name == "something"){
System.Diagnostics.Debugger.Launch();
System.Diagnostics.Debugger.Break();

// more lines of code
}

In this case, the scheduler will run only if I stop the scheduler service and start it again after that when the scheduler started it will execute the below lines and does not stop the execution.


Regarding users. I am not in a domain environment and there is only one user on my machine.
sameermoin
Regular Contributor
Regular Contributor
 
Posts: 75
Joined: Wed Jun 15, 2022 4:02 am
Topics Solved: 1

Re: Attached Debugger not working  Topic is solved

Postby Mike.Sheen » Fri Sep 09, 2022 7:26 pm

sameermoin wrote:I have an if condition in the scheduler service Execute method.

if(Schedule.Name == "something"){
System.Diagnostics.Debugger.Launch();
System.Diagnostics.Debugger.Break();

// more lines of code
}

In this case, the scheduler will run only if I stop the scheduler service and start it again after that when the scheduler started it will execute the below lines and does not stop the execution.


The first time it does break, in Visual Studio put a breakpoint in the code - even on the lines System.Diagnostics.Debugger.Launch(); or System.Diagnostics.Debugger.Break(); would be fine. Leave Visual Studio open, and you'll be able to debug after the first execution.
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: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 36 guests