[Mono-list] Null task exception when doing ContinueWith

Giuliano Barberi gbarberi at aotaonline.com
Fri May 2 11:17:10 UTC 2014


Hey guys I'm seeing something strange. It could totally be user error but I
can't seem to figure it out.

I am doing this on some tasks that I never await in order to get the
exception:
        public static Task CatchUnhandledException(this Task task)
        {
            return task.ContinueWith(continuation =>

Engine.UnhandledExceptionHandler(continuation.Exception),
                              TaskContinuationOptions.ExecuteSynchronously
| TaskContinuationOptions.OnlyOnFaulted);
        }

and the Engine.UnhandledExceptionHandler just logs the exception.

What's strange is that the exception is null and also doing
an Environment.StackTrace in the handler also yields nothing. I do have
--debug with the mdb files so I would suspect to get the full stacktrace. I
never saw this issue when I was running on .NET runtime but I also have
added more async code since so I'm not sure if it's something with Mono or
my app. I just can't find anything online and the documentation for Tasks
says that if it's faulted state there will be an exception.

Regards
-- 
Giuliano Barberi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20140502/3589eaeb/attachment.html>


More information about the Mono-list mailing list