Announcements
Hello,
I've written a very short piece of code:
class VendAccountRename { /// <summary> /// Runs the class with the specified arguments. /// </summary> /// <param name = "_args">The specified arguments.</param> public static void main(Args _args) { VendTable vendTable; ttsBegin; select firstOnly vendTable where vendTable.AccountNum == '1001'; if (vendTable) { vendTable.AccountNum = 'US-1002'; vendTable.renamePrimaryKey(); } ttsCommit; } }
Then I set up my class as start up object by right-click on it.
Then I put a break point like that:
Then I attached to the w3wp.exe process.
The I start debugging and by break point shifts to the other line by itself like that:
Also step over and step into commands are greyed out and I can't debug step by step:
Could you please tell me what I'm doing wrong?
Thank you in advance.
Thanks everybody for your answers. it's worked.
Hello,
The most simple method to debug your runnable class is as following steps:
1. Set your runnable class as start up object in solution explorer, the class name will be in bold type
2. Set breakpoint on a line
3. Click the Start button, then symboles will be loaded
4. Then the breakpoint will be hit, like this
If its a runnable class try to run it using browser after attaching it to w3wp.exe or run it using start button in VS after setting it as a start up object. Also sometimes if you insert a space between code lines and forgot to build in that case you will see weird behavior while debugging . Try to build your code and then trigger execution.
Way to trigger runnable class through browser
xxxxx.cloudax.dynamics.com;mi=SysClassRunner&cls=Yourrunnableclassname
If there is no yellow arrow over the breakpoint the code execution is not in that line. That's why you can't step over, either. Your code is not running.
Also the line with ttsbegin is the first line that does something. The variable declaration don't do anything so you can't debug it. So that's why the breakpoint moved.
Maybe you have confused two ways of debugging:
- if you set startup object you must click Start debugging in VS. Not attach to process.
- if you attach to w3wp you should run your process from D365FO UI (in your case you need to use the class runner to run your class). Google it if you don't know how to use class runner.
To me it seems you have just attached to process but you haven't triggered D365FO code execution at all. So the debugger is waiting but nothing else is happening.
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156