Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Answered

Error : "Could not load file or assembly 'System.Text.Json "when I try to run custom workflow that uses it

(0) ShareShare
ReportReport
Posted on by 30

Hello,

When I try to run my custom workflow code that uses the reference System.Text.Json to deserialize a Json file, I get this error. If I understand correctly this is not supported inside CRM? I tried googling it, but I got a lot of mixed answers. Some where about using Newtonsoft.Json with ILmerge. Some other said that I Newtonsoft is not supported, but that System.Text.Json should be fully supported. So my question is how do I deserialize a json file in a custom workflow in CRM 2016?

Thank you

addition info:

System.Text.Json seems to require netcore version 4.6.1 so that's the one that I used.

I am using CRM 2016

Here is the error message:

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Unexpected exception from plug-in (Execute): APISync.CRMConnector: System.IO.FileNotFoundException: Could not load file or assembly 'System.Text.Json, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.Detail:
<OrganizationServiceFault xmlns:i="">www.w3.org/.../XMLSchema-instance" xmlns="">schemas.microsoft.com/.../Contracts">
<ErrorCode>-2147220956</ErrorCode>
<ErrorDetails xmlns:d2p1="">schemas.datacontract.org/.../System.Collections.Generic" />
<Message>Unexpected exception from plug-in (Execute): APISync.CRMConnector: System.IO.FileNotFoundException: Could not load file or assembly 'System.Text.Json, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.</Message>
<Timestamp>2020-09-21T20:51:48.2706629Z</Timestamp>
<InnerFault i:nil="true" /

  • Bihar Profile Picture
    Bihar on at
    RE: Error : "Could not load file or assembly 'System.Text.Json "when I try to run custom workflow that uses it

    Will it support for nested JSON response

  • dev2143 Profile Picture
    dev2143 30 on at
    RE: Error : "Could not load file or assembly 'System.Text.Json "when I try to run custom workflow that uses it

    Thank you I managed to make it work with DataContractJsonSerializer.

  • Verified answer
    Bipin D365 Profile Picture
    Bipin D365 28,964 Super User 2024 Season 1 on at
    RE: Error : "Could not load file or assembly 'System.Text.Json "when I try to run custom workflow that uses it

    Hi,

    Check below blog which talks about deserializing json object in supported way without using newtonsoft dll.

    www.inogic.com/.../

    Please mark my answer verified if i were helpful

  • Verified answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Error : "Could not load file or assembly 'System.Text.Json "when I try to run custom workflow that uses it

    Hello,

    You can use Newtonsoft.Json library and merge it using ILmerge but as you mentioned it will be unsupported but it will work. If you want to use supported approach check following post - develop1.net/.../ILMergeNotSupported

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans