
In Microsoft Dynamics 365 for finance and operations, when you use .Net assemblies or classes it is important that you code should handle & capture & catch all the .Net inner exceptions.
- Sample Code-
- Here i am using ClrInterop::getLastException() & ClrInterop::get_InnerException()
try
{
//your code which is using .net assemblies
}
catch (Exception::CLRError)
{
ex = ClrInterop::getLastException();
if (ex != null)
{
ex = ex.get_InnerException();
if (ex != null)
{
error(ex.ToString());
}
}
}
One thought on “D365 FO:Catch exceptions & Inner exceptions thrown from CLR objects Using ClrInterop & X++”