RSS

Debug from Visual Studio X ++ code running on the server AX 2012

25 Nov

Much of the code we developed in X ++ classes running on the server layer ( Data Providers reports, processes Batch , SysOperation , …), which is a little uncomfortable when debugging. If we put a breakpoint from the X ++ editor in MorphX in code running on the server, we see how the integrated debugger never stops at this point.

Prepare the development environment for debugging server code from Visual Studio (including the X ++ code, the server always runs as CIL code) forces us to consider a few prerequisites, so I’ll list here to keep on hand when we do need:

Prerequisites and prior considerations:

  • Ensure that the code CIL is fully executed without errors. Otherwise, we want to debug the assembly may not be available in its latest version, but the last to be compiled without errors.
  • To debug remote code to run Visual Studio as long as Administrator (with elevated privileges by clicking -right> Run as administrator). Otherwise, we will have problems later permissions.
  • Remote debugging from Visual Studio must be on the same server where the AOS is installed, indirectly forcing us to use a development environment, because this is not ideal for production OSA configuration.
  • AOS configuration option must be on Enable breakpoints to debug X ++ code runing on this server (this is also not recommended in production OSA).
  • Associate a process for purifying AOS puts the server in a state extremely unstable , with very significant risk that the service restarts unexpectedly. Therefore it is highly recommended to use a development server isolated not to disturb the other developers.If we use a single AOS for all developers, it may be interesting to take another AOS for remote debugging.

Start the remote debugging:

  • Start Visual Studio on the server and Elevated.
  • If you are not already showing, show the Application Explorer (from the menu View ), which shows the OSA VS.
  • Navigating the Application Explorer and put breakpoints where we want to stop running (add breakpoins in Visual Studio , notMorphX !!).
  • If the message appears in the status bar of Visual Studio (at the bottom of the window) “Loading symbols” is best to wait until this process is complete. The first is a slow process; The following times will run much faster.

loading-symbols

  • Go to menu Debug> Attach to Process
  • Activate the checkbox Show processes from all users and show processes for all sessions , select the process Ax32Serv.exe AOS we want debug and press Associate .

Visual Studio - Attach to Process

  • After this process you may be reloaded symbols (X ++ code and assembled AOS CIL is discharged to the session of Visual Studio). All code is downloaded to C: \ Program Files \ Microsoft Dynamics AX \ 60 \ Server \ <NAME AOS> \ bin \ XppIL \ source for Visual Studio has access to the show and we in the editor.
  • When you have downloaded all objects, and can run our application and to reach the breakpoint , it will stop at the open session ofVisual Studio (not the debugger MorphX ).
  • If you are trying to debug is invoked from an external application, such as a web service, we can have another instance of Visual Studio open to run. In this case it should be a different instance of Visual Studio we use to debug it is associated with OSA.
  • If we let all the symbols are downloaded, we can surf the execution routinely, but sometimes the source of some objects will not be available during debugging. In this case we can stop debugging and open the object in the Application Explorer , to make sure thatVisual Studio has downloaded.

More information:

Advertisements
 
Leave a comment

Posted by on November 25, 2015 in Debugging, Uncategorized

 

Tags: ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
All About Dynamics 365

Dynamics 365, D365, Implementor

Syed Rafay Ali

This blog contains information about Functional techniques and guidelines in Microsoft Dynamics AX, including tips, tricks, tutorials, tools and upcoming news enhancement in Microsoft Dynamics Ax

Philippsen's Blog

Everyday findings in my world of .net and related stuff

Microsoft Dynamics AX

A great WordPress.com site

Finite Minds

Adventures in IoT

Dynamics Ax

Technical Knowledge

timsaxblog

A blog about implementing Microsoft Dynamics AX and Dynamics 365 for Operations

Microsoft Dynamics 365 Blog

"Learn it all, not Know it all" in Dynamics 365 - Enterprise Edition, A Blog by Sandeep Chaudhury

DEVSerra - Dynamics AX development blog

Your official Microsoft Dynamics AX blog.

OrganicAX

Discovering Dynamics

AX

A blog by Hai Nguyen

Learn Dynamics Ax with Johnkrish

Live as if you were to die tomorrow. Learn as if you were to live forever - Mahatma Gandhi ****** The more I learn, the less I know - Albert Einstein

Twisted Untwirled

Just another WordPress.com site

ramdynamicsax

Just another WordPress.com site

guyterry's Dynamics AX blog

Just another Dynamics AX blog

%d bloggers like this: