Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Error* "The model element was saved with unparsable source code and cannot be used".

(0) ShareShare
ReportReport
Posted on by

An  event handler class is created for a form extension to handle some new added form controls , when I build the project I face the below error:

(The model element was saved with unparsable source code and cannot be used. Please edit the element in Visual Studio to fix the errors)  in event handler class xpp file , how can I fix this issue ?

*This post is locked for comments

  • Shabir Ahmad Profile Picture
    3,090 on at
    RE: Error* "The model element was saved with unparsable source code and cannot be used".

    Thanks for your suggestion, it also work for me, cut some  piece of code and repaste it this works for me

  • Onyinluv Profile Picture
    7 on at
    RE: Error* "The model element was saved with unparsable source code and cannot be used".

    This error occurred due to an initial action of copying and pasting from one form or table to another.

    On pasting of the field, group, tabs etc that was copied, It had some methods attached to it.

    Kindly view the class, form or event handler with the error, locate the method foreign to the form or event handler with the error and delete it. (copy out your code to a notepad and review it).

  • prodev42 Profile Picture
    270 on at
    RE: Error* "The model element was saved with unparsable source code and cannot be used".

    cutting out some code, repaste, save file, compile solution worked for me..tkx for the tip

  • Zain Bokhari Profile Picture
    3,208 Moderator on at
    RE: Error* "The model element was saved with unparsable source code and cannot be used".

    By the way the heading for this thread "Creating event handler class for form extension in AX 365" was not really pointing to the issue you are discussing in this thread. So I changed it for you. When your issue is resolved please verify the helpful answers and close this thread. Thanks.

  • maram fraij Profile Picture
    on at
    RE: Creating event handler class for form extension in AX 365

    Thank you Zain for your support & knowledge sharing

  • Zain Bokhari Profile Picture
    3,208 Moderator on at
    RE: Creating event handler class for form extension in AX 365

    Well maram maybe someone else has another idea but this is the best to my knowledge for this right now,

    I faced this issue only once and that is how I had to resolve it, after that I build my work after every small change I make. Has not happened to me again.

    I would think that If you keep building your solution along the way properly you shouldn't see it again.

  • maram fraij Profile Picture
    on at
    RE: Creating event handler class for form extension in AX 365

    I just try to find the resolution for such error if I face it another time since making vague changes is not reasonable resolution , also removing the class and adding it again is not the best resolution?  

  • Zain Bokhari Profile Picture
    3,208 Moderator on at
    RE: Creating event handler class for form extension in AX 365

    Did you remove and added the class you are working on?

    Save the code, delete the class completely, rebuild your project.

    After that create the class again, add the code then rebuild. Try doing that.

  • maram fraij Profile Picture
    on at
    RE: Creating event handler class for form extension in AX 365

    I've just tried to rebuild  without making   vague  changes but it does not work

  • Zain Bokhari Profile Picture
    3,208 Moderator on at
    RE: Creating event handler class for form extension in AX 365

    There is no need to rebuild the whole project every single time you make a small change, just keep building while you're making changes and make sure there are no errors, then when you are done making changes. Rebuild your project to sort out any inconsistencies if any.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,265 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,927 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans