peterh
Topic Author
Posts: 21
Joined: 13 Mar 2015, 13:50

Noesis swallows useful exception information.

01 Sep 2015, 12:26

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?
 
User avatar
sfernandez
Site Admin
Posts: 1918
Joined: 22 Dec 2011, 19:20

Re: Noesis swallows useful exception information.

03 Sep 2015, 18:06

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
    } 
 
peterh
Topic Author
Posts: 21
Joined: 13 Mar 2015, 13:50

Re: Noesis swallows useful exception information.

04 Sep 2015, 15:41

That's great, thanks!

Who is online

Users browsing this forum: No registered users and 0 guests