[Mono-bugs] [Bug 497175] New: Exceptions thrown in a method that is invoked via Control.Invoke are not propagated to the caller

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Apr 22 04:30:56 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=497175


           Summary: Exceptions thrown in a method that is invoked via
                    Control.Invoke are not propagated to the caller
    Classification: Mono
           Product: Mono: Class Libraries
           Version: unspecified
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: Minor
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: tspink at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Development


Description of Problem:
When Control.Invoke is used to invoke a method, if that method throws an
exception it does not get propagated back to the caller - rather an unhandled
exception occurs.  The Microsoft implementation does propagate this exception,
which can then be caught with in a try..catch block.

To fix this, AsyncMethodResult.EndInvoke should throw the exception (if any was
generated), and this will automatically fix Control.Invoke, and indeed any
handlers in async callbacks using Control.EndInvoke.

I've created a patch to introduce this functionality, but am unsure as to where
to post it for review.

Steps to reproduce the problem:
1. Create a method that throws an exception.
2. Call that method using Control.Invoke, and wrap it in a try..catch block


Actual Results:
An unhandled exception.

Expected Results:
A caught exception.

How often does this happen? 
Always.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list