Skip to main content

Notifications

Finance forum

debugging issue

(0) ShareShare
ReportReport
Posted on by 768

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:

4212.111.JPG

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:

4555.112.JPG

Also step over and step into  commands are greyed out and I can't debug step by step:

6557.113.JPG

Could you please tell me what I'm doing wrong?

Thank you in advance.

  • dark_knight Profile Picture
    dark_knight 768 on at
    RE: debugging issue

    Thanks everybody for your answers. it's worked.

  • Verified answer
    Jie G Profile Picture
    Jie G on at
    RE: debugging issue

    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

    5050.00.png
    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

    5050.00.png

  • Verified answer
    Sukrut Parab Profile Picture
    Sukrut Parab 71,656 Moderator on at
    RE: debugging issue

    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

  • Verified answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: debugging issue

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

News and Announcements

Announcing Category Subscriptions!

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,359 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans