Exception handling in PU31

In 2018, I wrote the blog post Throwing managed exceptions from X++ in D365FO, where I pondered upon how throwing proper exceptions objects in X++ would be beneficial. This is still true. I also showed a proof of concept how it can be done despite the fact that X++ doesn’t directly support it. But this …

Continue reading ‘Exception handling in PU31’ »

Throwing managed exceptions from X++ in D365FO

Update! PU31 has added the ability to throw managed exceptions. Read more about it here. What I really miss in X++ is the ability to throw exception objects. If you throw an exception in X++, it’s just a number defining what kind of exception it is, which usually says just “Error” (Exception::Error). You also typically …

Continue reading ‘Throwing managed exceptions from X++ in D365FO’ »

First chance exceptions

Dynamics 365 for Finance and Operations runs completely in “.NET”, which has some interesting implications. The runtime and tools working with it (such as Visual Studio) offer many new options that may be very useful. One of these options is the ability to catch first chance exceptions. When an exception is thrown, it’s considered a …

Continue reading ‘First chance exceptions’ »

Catching exceptions in AX 7

In this blog post, I briefly recapitulate how to throw and catch exceptions in X++ and introduce a new way of handling CLR exceptions in AX 7. X++ exceptions When you want to throw an exception in X++, you typically do it by something like this: throw error("It’s broken!"); It’s a functional equivalent of adding a …

Continue reading ‘Catching exceptions in AX 7’ »

Exception handling with X++ and .NET Interop

A recent discussion on the community forum about exception messages prompted me to test the given case thoroughly and I think the results are worth sharing. The post also mentions something what I already found before – that error handling can be tricky in code which uses .NET Interop and which can be executed as …

Continue reading ‘Exception handling with X++ and .NET Interop’ »