axCoder

Microsoft Dynamics Ax developer's blog

Wednesday, November 19, 2014

Static code analysis using XLNT

In ax 2012 there is a code upgrade tool based on parser named XLNT - it allows to use syntax tree if X++ from .NET.

I have written a small example of static analysis for X++ based on that technology  http://1drv.ms/1u9Rs8x

It detects code patters that are likely to be copy-and-paste errors (when somebody copies code but forget to change something in a copy) like:

case X: some code
...
case X: some code

if (x) {
   y
}
else
{
   y
}



 

Tuesday, July 30, 2013

How to become an axapta administrator with powershell


$sid = [System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value

osql -d AXDBDEV -p -E -Q "update userinfo set sid = '$sid', networkdomain = '$env:userdomain', networkalias = '$env:username' where ID = 'admin'"

Friday, April 27, 2012

Did you know, that you can drag and drop from debugger?

When I debug complex code, I open OneNote, dock it to the right border of screen and save some variables values from debugger there.
Previusly, I used copy and paste from "locals" or "watch" windows and it looked like there:

NAME:

               _closeAmountReporting

VALUE:

               128.57

TYPE:

               real
Today I've tried to drag&drop a value and it looked like there:

_closeAmountReporting 128.57   real

which is more compact and comfortable representation.

Monday, April 09, 2012

Code folding in ax 2012

As mentioned Martin Drab, editor extensions for VS 2010 work also in Ax 2012. Including code outlining example. Below is CustVendSettle.settleNow, lines 111 to 777:

Monday, February 06, 2012

DEV_Toolbar: tabax for Ax2012

I am sharing a tabax successor for Ax6 as an example of usage WPF control.

The form uses standard tab control from WPF with a custom template.

Also you can use it as an example of event handling.

The code has a problem which I can not resolve now: if you press a middle or right mouse button on a tab, vontr scrolls to the start - so you can accidentially close wrong tab. Now the workaround provided: if such event occured, event handler uses selected tab instead of tab under click

Tuesday, July 12, 2011

XRef–> DGML

image

Just updated my old sample to produce DGML in addition to .DOT, so now you can view cross-references in VS2010 interactively (filter, rearrange so on). For example picture above shows relations of LedgerVoucherObject.check



Download the job from SkyDrive: