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

AX 2012 R3 Custom DLL .NET

(0) ShareShare
ReportReport
Posted on by 302
Hi,
 
We use AX 2012 R3 for a while. We want to use .NET DLL in our system to interact with third-party systems. X++ doesn't allow certain operartion but  .NET looks like fine. I am new in this part of DLL so I started to TEST how to do the whole process. For this purpose I implemented and easy JsonManager to Serialize / unserialize data. Here the example below. I taked the DLL and I copied to the bin directory in the client side. I imported from the AOT (referenced). I make a test via job using x++. The execution failed when I called JSONManager::SerializeObjectToJson or JSONManager::DeserializeJsonToObject. I don't know if it is something I have to add to the C# code or I need to compile with a certain .NET version or I need to sign it. Or it is something I did wrong in X++. thank you
 
 
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using Newtonsoft.Json;namespace JSON{    public class JSONManager    {        // Serialize an object to JSON        public static string SerializeObjectToJson(object obj)        {            return JsonConvert.SerializeObject(obj);        }        // Deserialize JSON to an object        public static T DeserializeJsonToObject<T>(string json)        {            try            {                return JsonConvert.DeserializeObject<T>(json);            }            catch (JsonReaderException ex)            {                // Handle JSON parsing errors                Console.WriteLine(/Error parsing JSON: {0}/, ex.Message);                return default(T);            }            catch (Exception ex)            {                // Handle other exceptions                Console.WriteLine(/An error occurred: {0}/, ex.Message);                return default(T);            }        }    }}
 
 
 
 
 
  • Martin Dráb Profile Picture
    Martin Dráb 231,317 Most Valuable Professional on at
    AX 2012 R3 Custom DLL .NET
    Please tell us more about the problem than mere "the execution failed". Did you get an exception? If so, what did the message say, what was the exception type and the stack trace?
     
    Which version of .NET Framework have you built your assembly for? Did your X++ job compile correctly?
     
    Also, please post your code once more. This site has a bug that distorts formatting in the first post, but it works in replies.

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,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,317 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans