Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration issue from 5.0.3 to 5.1.1 - Application is null / MvxFormsAppCompatActivity / base.OnCreate(bundle) / Resolved, but useful info #2129

Closed
1 of 4 tasks
mgoodfellow opened this issue Aug 21, 2017 · 0 comments
Labels
t/docs Documentation type
Milestone

Comments

@mgoodfellow
Copy link

Steps to reproduce

The old method of setting up a view presenter in Setup.cs (Android) was to use something like:

protected override IMvxAndroidViewPresenter CreateViewPresenter()
{
    var presenter = new MvxFormsDroidPagePresenter();
    Mvx.RegisterSingleton<IMvxViewPresenter>(presenter);

    return presenter;
}

This unfortunately overrides the view presenter, and means that here in MvxFormsAppCompatActivity.cs won't resolve properly.

In turn this means that:

base.OnCreate(bundle); in your MainActivity when overriding MvxFormsAppCompatActivity will throw an NullReferenceException saying that "application is null`.

This had me banging my head against a wall for quite a long time, but I managed to work it out by looking at the new implementation in MvxFormsAndroidSetup.

I noticed that CreateFormsApplication was not being called - it might not be immediately obvious to other users updating from older MvvmCross versions!

Configuration

Version: 5.1.1

Platform:

  • iOS
  • Android
  • WPF
  • UWP
@martijn00 martijn00 added the t/docs Documentation type label Aug 21, 2017
@martijn00 martijn00 added this to the 5.5.0 milestone Nov 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t/docs Documentation type
Development

No branches or pull requests

2 participants