Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3427352
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:49:33+00:00 2026-05-18T06:49:33+00:00

I think I have found a situation where RescueAttribute is broken. Or maybe I

  • 0

I think I have found a situation where RescueAttribute is broken. Or maybe I am using co-routines incorrectly.

I have a ViewModel like this:

[Rescue("Rescue")]
class MyViewModel
{
    //... left out some bus-logic code here ...

    public void Login()
    {
        yield return Show.Busy();

        //the following line will also cause the problem, just like AsyncResult
        //yield return Show.MessageBox("Test");

        yield return new AsyncResult(() => _server.Login());

        //throw new Exception("Aww, snap!");

        yield return Show.NotBusy();
    }

    public void Rescue(Exception exc)
    {
        //Show a messagebox or something
    }
}

AsyncResult is implemented like so:

using Exec = Caliburn.PresentationFramework.Invocation.Execute;

    public class AsyncResult : IResult
    {
        private readonly Action _function;

        public AsyncResult(Action function)
        {
            _function = function;
        }

        public void Execute(ResultExecutionContext context)
        {
            Exec.OnBackgroundThread(delegate
            {
                try
                {
                    _function();
                }
                catch (Exception exc)
                {
                    Exec.OnUIThread(() => Completed(this, new ResultCompletionEventArgs { Error = exc, WasCancelled = true }));
                    return;
                }
                Exec.OnUIThread(() => Completed(this, new ResultCompletionEventArgs()));
            });
        }

        public event EventHandler<ResultCompletionEventArgs> Completed = delegate { };
    }

If I uncomment the exception in my above ViewModel, Rescue fails to handle the exception.

Is this a bug in Caliburn, or is AsyncResult implemented wrong?

If you put an exception before the yield to return an AsyncResult, Rescue works just fine. Also if the exception is thrown on the async thread, rescue still works!

EDIT: you can also use Show.MessageBox instead of AsyncResult to reproduce the same problem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T06:49:34+00:00Added an answer on May 18, 2026 at 6:49 am

    It seems a legitimate bug. I added an issue for this in the Caliburn tracker: http://caliburn.codeplex.com/workitem/7636

    EDIT: the issue was fixed
    see: http://caliburn.codeplex.com/Thread/View.aspx?ThreadId=234229

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

One thing I have continually found very confusing about using an object database like
I think I have this working but I need advice. I'd like to know
I have this simple situation: @Entity public class Customer{ @ManyToMany(fetch=FetchType.EAGER) @Cascade(CascadeType.SAVE_UPDATE) private List<Product> products=new
I think I have a solution to this, but is there a better way,
I think I have a problem in understanding the proper way of using MVC.
I have a situation where I have 8 steps (think of it as a
When a deadlock situation occurs in MySQL/InnoDB, it returns this familiar error: 'Deadlock found
I have a situation where I am using a third party library. On machines
We have a button that saves asynchronously using AjaxToolKit/C#/.NET. I'm getting this in my
Currently in our enterprise we have a situation that i think it's not very

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.