Monday, April 3, 2017

A gentle introduction to the Immediate Window

Ivan Kashperuk wrote a blog post a while ago about using the Immediate Window when debugging. I wanted to do a more gentle introduction to it, hopefully making you want to go read Ivan's much more thorough post.

The Immediate Window is one of the windows that are open while you debug. The idea is that you can get it to perform simple X++ expressions, using the variables of the program you are debugging.

Now in Dynamics 365 for Operations a thing like tables ids or class ids is not something you can see in the AOT, so debugging a piece of code using these id's can be difficult. You don't know which tables or class names the id's correspond to. This is where I for now use the Immediate Window most, calling something like this (where _tableId is a variable in my program):

There are some technicalities you have to bear in mind when using this. You have to use .NET syntax and .NET types for the expression, it is case sensitive and it is not able to deal with all statements from X++ (like for example a select statement).

You can to some extend use the same expressions from the Immediate Window as conditional breakpoinst. There are some caveats though. If you call stuff from the AOS kernel, some pieces of the kernel are still written in unmanaged code and they will fail with different kinds of errors. Only the parts of the kernel written in managed code will work.  

If you don't follow Ivan's blog already, you should. It is one the of best blogs for developer related information. You can find it at this URL: