Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / Debug watch not showin...
Finance forum

Debug watch not showing value: An object reference is required for the non-static field

(0) ShareShare
ReportReport
Posted on by 270

Hi All,

I have a form, using the code editor, I declare an amount type right in the beginning with below code

"Amount  X;"

Then in its Datasource, in method validateWrite(), 

I have a line  "X = element.aFunction();"

Anyone know why when I debug to the line above and try to add a watch to the value of X the debugger says "error CS0120: An object reference is required for the non-static field, method, or property?

  • prodev42 Profile Picture
    prodev42 270 on at
    RE: Debug watch not showing value: An object reference is required for the non-static field

    [quote user="ievgen Miroshnikov"]

    Hi prodev42,

    Add "element" to watch and expand it. THere you should be able to see "X" and its value.

    [/quote]

    Thanks. I also notice similiar issue for extended table fields, I had to add the field extended_field to watch. Maybe it is something the editor can improve on.

  • Verified answer
    Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Debug watch not showing value: An object reference is required for the non-static field

    Hi prodev42,

    Add "element" to watch and expand it. THere you should be able to see "X" and its value.

  • Jie G Profile Picture
    Jie G on at
    RE: Debug watch not showing value: An object reference is required for the non-static field

    Hi Prodev42,

    It seems that you are calling a non static property from a static method.

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

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,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans