Proxies and Exception Mapping
Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012
When an X++ object throws an exception, the exception value is an integer element from the X++ Exception enum. If the X++ object is being managed by a proxy object in the .NET Framework, the thrown element value of the enum is automatically marshaled into an instance of a .NET Framework exception class. This class is designed to represent the enum element.
Name Pattern
There is a pattern of name correspondence between values of the X++ Exception enum and the .NET Framework exception classes that represent the enum values. There are approximately 15 elements in the Exception enum. The following table shows 3 examples of the pattern. For instance, the last row in the table shows that the enum element and the exception class are both named with the word Deadlock.
X++ Exception enum element |
Word in common |
.NET Framework exception class |
---|---|---|
Exception::Error |
Error |
Microsoft.Dynamics.AX.ManagedInterop.ErrorException |
Exception::Warning |
Warning |
Microsoft.Dynamics.AX.ManagedInterop.WarningException |
Exception::Deadlock |
Deadlock |
Microsoft.Dynamics.AX.ManagedInterop.DeadlockException |
Inheritance Hierarchy of the .NET Exception Classes
The following indented list of .NET exception classes shows the inheritance hierarchy of the ErrorException class. This is one of the exception classes that a proxy object might encounter if the underlying X++ object has a problem. The inheritance hierarchy is the same for the other exceptions such as Microsoft.Dynamics.AX.ManagedInterop.WarningException.
System.Exception
Microsoft.Dynamics.AX.ManagedInterop.XppBaseException
Microsoft.Dynamics.AX.ManagedInterop.ManagedInteropException
Microsoft.Dynamics.AX.ManagedInterop.XppException
Microsoft.Dynamics.AX.ManagedInterop.ErrorException
Exceptions Not From the X++ Object
A proxy object can encounter exceptions that have nothing to do with the behavior of its underlying X++ object. For example, if the Application Object Server (AOS) is stopped by the administrator, the proxy can encounter a Microsoft.Dynamics.AX.ManagedInterop.ServerUnavailableException. This ServerUnavailableException class extends the Microsoft.Dynamics.AX.ManagedInterop.ManagedInteropException class.
See also
Proxy Classes for .NET Interop to X++
Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. Get your copy at the MS Press Store.