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:

 
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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

 
axhowto

Blog about ax with sample codes, tips and tricks.

GM Dynamics Blogs

Transform IT with Digital Trasformation and Social Innovation

Ms. Dynamic Millennial

Unboxing Microsoft Dynamics 365 for Finance and Operations

DynaD365Power

Exploring the new vision of the Power platform

Dynamics Vision 365

The FinOps pulse

Breaking Bong

I write when no one is watching

ErpCoder

Microsoft Dynamics 365 Business Management Solution Enthusiast

Dynamics 365 Finance

Dynamics 365 Finance & Much More.

Microsoft Dynamics AX

“ANYONE WHO STOPS LEARNING IS OLD, WHETHER AT TWENTY OR EIGHTY.” —HENRY FORD

Sumit Potbhare

Dynamics 365 for Commerce

iotsolution.se

This is your site about D365 (Finance and Supply Chain Management), IoT (Internet of Things) and HoloLens

Omni 365

Dynamics 365 Finance and Operations Blog

DIY D365

Power Platform Done Your Way

Azure Integration services for Dynamics 365

Azure Integration services for Dynamics 365 Unified Operations, Logic Apps, Azure Functions, REST

%d bloggers like this: