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 7877855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:29:46+00:00 2026-06-03T03:29:46+00:00

We’re developing a cross platform application for iOS, Android and WP7 by using MVVMCross

  • 0

We’re developing a cross platform application for iOS, Android and WP7 by using MVVMCross framework and I’m missing a method in MvxApplication that I can override which can serves as the platform neutral unhandled exception handler (which gets called by the platform specific ones).

So the question is what is the suggested way to handle exceptions generally and during an async call in a MVVMCross application?

Thanks,
Attila

  • 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-06-03T03:29:48+00:00Added an answer on June 3, 2026 at 3:29 am

    For genuinely unexpected exceptions (crashes!) then this question is currently unanswered: see crash reporting in MonoTouch and MonoDroid


    However, for a suggestion on how you might handle exceptions during an async call, then take a look at the BestSellers example: MvvmCross BestSellers Sample

    BestSellers uses 2 techniques that I find I’ve used quite a lot in MvvmCross applications:

    • the use of BaseViewModel classes for shared ViewModel code like error handling
    • the use of an app level “error router” to get errors from the ViewModels to UI notifications like UIAlertViews, Toasts and/or MessageBoxes.

    At a more detailed level, what BestSellers does is:

    Each ViewModel uses a direct call to a webservice for book information. For example the Category List is constructed as:

        public CategoryListViewModel()
        {
            AsyncLoad();
        }
    
        private void AsyncLoad()
        {
            GeneralAsyncLoad(URL_CATEGORIES, ProcessResult);
        }
    

    where GeneralAsyncLoad is defined in a shared BaseViewModel:

        protected void GeneralAsyncLoad(string url, Action<Stream> responseStreamHandler)
        {
            try
            {
                IsLoading = true;
                var request = WebRequest.Create(url);
                request.BeginGetResponse((result) => GeneralProcessResponse(request, result, responseStreamHandler), null);
            }
            catch (ThreadAbortException)
            {
                throw;
            }
            // obviously we could do better than catching all `Exception` here!
            catch (Exception exception)
            {
                IsLoading = false;
                ReportError("Sorry - problem seen " + exception.Message);
            }
        }
    

    The ReportError method within the above exception handler uses an injected object – an IErrorReporter.

    This injected object is initialised as a singleton during App construction – see ErrorApplicationObject in App.cs

    During their construction and setup, the UI projects all subscribe to events from that same singleton – but using an IErrorSource interface instead or IErrorReporter.

    This then allows each platform to display it’s own error display – e.g.:

    • iOS shows an UIAlertView in its ErrorDisplayer.cs
    • Android shows a Toast in its ErrorDisplayer.cs
    • WP7 shows a MessageBox from code within App.xaml.cs

    Obviously, if you need error handling as well as error displaying – e.g. if you want to retry the asynchronous operation or if you want to load an offline copy of data instead – then you can add this to your error handling within the ViewModel and the BaseViewModel.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am doing a simple coin flipping experiment for class that involves flipping a
We're building an app, our first using Rails 3, and we're having to build

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.