Page 1 of 1

Noesis swallows useful exception information.

Posted: 01 Sep 2015, 12:26
by peterh
Oftentimes when an exception is thrown and not handled in Noesis related code, the exception is simply routed to the method Noesis.Error.SetNativePendingError(). When running in the Unity editor, a Noesis error window will pop up with messages in the vein of:
Unhandled exception at 0x000007FEE25C1100: Access Violation reading location 0x0000000000000018
The above example is a class cast exception inside an eventhandler for FrameworkElement.Loaded, but nowhere in the error text is this shown.

This makes errors in UI code unnecessarily hard to solve, which takes time away from actually being productive with Noesis. Would it be possible to change this behaviour into something that preserves information such as stack trace?

Re: Noesis swallows useful exception information.

Posted: 03 Sep 2015, 18:06
by sfernandez
Hi Peter,

There was a bug in the exception handling of the Loaded event that lead to some unhandled exceptions that avoid showing the initial error (with the full call stack) in the Unity console.

We found the problem thanks to the project your team posted in our bugtracker in another ticket. We have fixed it for the next 1.2.5 release.

Meanwhile, to ensure you always get full info about any error thrown in your handlers, you might modify SetNativePendingError() to dump the exception before transferring it to native code:
    public static void SetNativePendingError(System.Exception exception)
    {
#if UNITY_EDITOR || NOESIS_API
        UnityEngine.Debug.LogException(exception); // +++
        Noesis_CppSetPendingError(exception.ToString());
#else
        UnityEngine.Debug.LogException(exception);
#endif
    } 

Re: Noesis swallows useful exception information.

Posted: 04 Sep 2015, 15:41
by peterh
That's great, thanks!