web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

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

Visual Studio DLL Problem in BATCH ax 2012

(0) ShareShare
ReportReport
Posted on by

Hi i have a problem

i created a visual studio project embemded in my AOT. This project generate a DLL that i use into a method in a server side class.

This is my project. Configurated with .net framework 3.5

pastedimage1592933015677v1.pngpastedimage1592933136062v2.png

This is my class configurated to Server side. In the Method ConsultarDocumentosResponse i call the DLL generated by my visual studio project

pastedimage1592933456912v4.png

When i call this method via form work perfect but this same method i called using a batch class and i got this error  

pastedimage1592937446344v5.png

then i restart the aos and got these error

pastedimage1592938635586v1.png

The error information say that my method ConsultarDocumentosResponse  has and error, but i compiled and cil but doesnt get and error. 

pastedimage1592939396476v1.png

In my method i have and errror message but in the batch error log doesnt appear, that mean for me that the DLL is no detected on execution time because this method use entities that are into the dll before mentioned (entities like MaintFacturacionElectronica35.Model.RespuestaAutorizacion)

I dont know what i can do for solve this problem

I see that my DLL is correctly copied in the paths 

AOS -> C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\VSAssemblies
Client -> C:\Users\jmiranda\AppData\Local\Microsoft\Dynamics Ax\VSAssemblies{AE1C9722-F088-48FE-8D33-D113EAB64F1F}

but doesnt appear in C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin maybe this mean something that i am not seeing

I tried restarting AOS, no make any diference

I tried compiling AOT and CIL FULL, no errors were detected

Regards

I have the same question (0)
  • Martin Dráb Profile Picture
    238,595 Most Valuable Professional on at

    That the file it's not in Client\Bin is correct, and even if it was a problem, it wouldn't be related to your issue (which is about code on the server tier, on on client).

    Isn't your library using anything that requires 32-bit processor architecture, for instance? Although I would expect BadImageFormatException in such a case.

  • JesusMiranda1993 Profile Picture
    on at

    In my visual studio i got this warning maybe that is the reason, but i tried to use x64/x86 in Target Platform but doesnt work even in client side if i make these change of configuration

    pastedimage1593003795918v1.png

    and i can see that multiple references are in located in C:\Program Files (x86)\ ...

    pastedimage1593004018452v3.png

    C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\bin\Microsoft.Dynamics.AX.ManagedInterop.dll
    C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\bin\Newtonsoft.Json.dll
    C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\bin\RestSharp.dll
    C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.ComponentModel.DataAnnotations.dll
    C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll
    C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll
    C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.Linq.dll
    C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Net.dll
    C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\System.Runtime.Serialization.dll
    C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\bin\System.Threading.dll
    C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll

    Any suggestion?
    regards
  • Martin Dráb Profile Picture
    238,595 Most Valuable Professional on at

    I think the warning can be ignored unless you actually use from ManagedInterop.

    I see you refer to Newtonsoft.Json and RestSharp on client. Do you have them on server as well?

  • JesusMiranda1993 Profile Picture
    on at

    yes i got them in my server path

    pastedimage1593004984398v1.png

  • Martin Dráb Profile Picture
    238,595 Most Valuable Professional on at

    Hmm, so what if you try to debug the code - both X++ and C#? It should at least confirm or invalidate the theory that the assembly can't be loaded.

  • JesusMiranda1993 Profile Picture
    on at

    Yes,

    I debug the job but it never goes into the ConsultarDocumentosResponse method which implements de dll objects

    pastedimage1593010689895v1.png

    pastedimage1593010767883v2.png

    Any suggestions in debug time?

  • Martin Dráb Profile Picture
    238,595 Most Valuable Professional on at

    Sorry, it's all a bit unclear to me. What are the screenshots suppose to show?

    Are you saying that you have a problem with debugging, or that an attempt to call the method throws an exception?

    Are you able to debug your X++ code in batch, or do you have a problem with debugging in general?

    Where is the line of X++ code calling the method and what's the declaration of the method?

  • JesusMiranda1993 Profile Picture
    on at

    Sorry, it's all a bit unclear to me. What are the screenshots suppose to show?
    - Show the line where the executing stop beacuse the call to the method handle an error

    Are you saying that you have a problem with debugging, or that an attempt to call the method throws an exception?
    - Yes, the call of the method throws an exceptopn but even the 1rst line doesnt executed

    Are you able to debug your X++ code in batch, or do you have a problem with debugging in general?
    -Yes, i debug the batch job for detect the error but it doesnt show me any value information

    Where is the line of X++ code calling the method and what's the declaration of the method?
    - The calling line is in red, the attached line. At the end of the code i have an try catch and is where the exception is controled

    pastedimage1593011870050v1.png

  • Martin Dráb Profile Picture
    238,595 Most Valuable Professional on at

    Hmm, I thought you said that it fails when your X++ code calls a method defined in a C# library. But that's not what the highlighted line does, is it? It calls a method in the same X++ class.

    If this is really the place where the exception is called (and not somewhere inside ConsultarDocumentosResponse()), then it's a different problem. You don't have a problem with calling the DLL - your code fails even before that.

  • JesusMiranda1993 Profile Picture
    on at

    The code fails because in the first lines of my job method I have a reference to an entity inside the DLL, so I think Ax is not detecting my DLL and generates an error as soon as the method is going to be executed. Even when debugging don't enter the called 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 679 Super User 2026 Season 1

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 332 Super User 2026 Season 1

#3
Martin Dráb Profile Picture

Martin Dráb 238 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans