Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Assembly containing type Newtonsoft.Json.JsonTextWriter is not referenced.

(0) ShareShare
ReportReport
Posted on by 195

Hi Everyone,

To over come a error "Invalid attempt to call to FormJsonSerializer.serializeClass running in CIL on the client" ii have changed the code from

public static client str serializeClass(Object _object) to public static server str serializeClass(Object _object).


Now i am facing error  as "Assembly containing type Newtonsoft.Json.JsonTextWriter is not referenced. & Object 'CLRObject' could not be created" while doing integration from AX to third party.

Can anyone please help me to solve the issue.

Regards,

Swetha.

  • Swetha Molagavalli Profile Picture
    Swetha Molagavalli 195 on at
    RE: Assembly containing type Newtonsoft.Json.JsonTextWriter is not referenced.

    Martin,

    I removed reference in AX and rebuild everything in scratch but still facing same error in FormJsonSerializer.new method.

    private void new()

       {

           stringWriter = new System.IO.StringWriter();

           jsonWriter = new Newtonsoft.Json.JsonTextWriter(stringWriter); ----- Facing error at this point

           nullPlaceholder = guid2str(newGuid());

           dateTimeBase = FormJsonSerializer::dateTimeBase();

       }

    Please help i am stuggling for past one week.

    Regards,

    Swetha.

  • Martin Dráb Profile Picture
    Martin Dráb 231,305 Most Valuable Professional on at
    RE: Assembly containing type Newtonsoft.Json.JsonTextWriter is not referenced.

    Verify that the file is in server bin. Verify the target processor architecture (I doubt it's the problem, but it's good to be sure that it isn't). Then you can use Assembly Binding Log Viewer to find more details about why the assembly can't be loaded.

  • Swetha Molagavalli Profile Picture
    Swetha Molagavalli 195 on at
    RE: Assembly containing type Newtonsoft.Json.JsonTextWriter is not referenced.

    Martin,

    I am taking about X++.

    Regards,

    Swetha.

  • Martin Dráb Profile Picture
    Martin Dráb 231,305 Most Valuable Professional on at
    RE: Assembly containing type Newtonsoft.Json.JsonTextWriter is not referenced.

    Hmm, you may run both X++ and CIL on server. Which case you're talking about right now?

  • Swetha Molagavalli Profile Picture
    Swetha Molagavalli 195 on at
    RE: Assembly containing type Newtonsoft.Json.JsonTextWriter is not referenced.

    Martin,

    There is no compilation errors and it is throwing same error when it runs on server.

    Regards,

    Swetha.

  • Martin Dráb Profile Picture
    Martin Dráb 231,305 Most Valuable Professional on at
    RE: Assembly containing type Newtonsoft.Json.JsonTextWriter is not referenced.

    Please give us more information. Does it compile? Does creating an instance work in X++ on server? I assume you're currently running it in CIL, as you mentioned a CIL-related error.

    Can't the DLL be for a different version of .NET Framework? (I don't remember how they release it.)

  • Swetha Molagavalli Profile Picture
    Swetha Molagavalli 195 on at
    RE: Assembly containing type Newtonsoft.Json.JsonTextWriter is not referenced.

    Martin,

    I have placed the dll file in both server and client bin. But we still facing the error.

    Regards,

    Swetha.

  • Martin Dráb Profile Picture
    Martin Dráb 231,305 Most Valuable Professional on at
    RE: Assembly containing type Newtonsoft.Json.JsonTextWriter is not referenced.

    Yes, putting the DLL to the bin folder is one of the options.

    You must put to server bin run your code on server. But you also need it on client if you want to compile your code (because compilation happens on client), even if you don't intended to run your code there.

  • Swetha Molagavalli Profile Picture
    Swetha Molagavalli 195 on at
    RE: Assembly containing type Newtonsoft.Json.JsonTextWriter is not referenced.

    Hi Martin,

    Yes we have back port it from D365. Added Newtonsoft.Json reference to AOT,done Full CIL.

    Does assembly on AOS  means adding DLL file in Bin folder? If so i have done it.

    Regards,

    Swetha

  • Martin Dráb Profile Picture
    Martin Dráb 231,305 Most Valuable Professional on at
    RE: Assembly containing type Newtonsoft.Json.JsonTextWriter is not referenced.

    AX 2012 doesn't seem to contain FormJsonSerializer class. Is it your attempt to backport if from D365FO?

    Did you add a reference to Newtonsoft.Json to AOT and did you install the assembly on AOS? Also, if you're running the thing in CIL, did you generate CIL?

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

Announcing Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans