Xamarin.forms: System.NullreferenceException after upgrade Xamarin 4.2.0.709249

Created on 5 Sep 2019  路  8Comments  路  Source: xamarin/Xamarin.Forms

_This issue has been moved from a ticket on Developer Community._


What steps will reproduce the problem?

  1. Android Project with Xamarin.Forms open
  2. Select Manage Nuget packages for Solution
  3. Choose Xamarin.Forms from Updates

all the files to be updated and then clean the project and build/deploy/run to Samsun S9 Phone in Debug mode (not emulator)
What is the expected output? Is the Application to run as it did before the update
What do you see instead? A System.NullReferenceException

Please provide any additional information below.

System.NullReferenceException
Message=Object reference not set to an instance of an object.

From Output Window
08-22 16:11:44.822 I/InputMethodManager( 3011): startInputInner - mService.startInputOrWindowGainedFocus
08-22 16:11:44.829 D/InputTransport( 3011): Input channel constructed: fd=84
08-22 16:11:44.829 D/InputTransport( 3011): Input channel destroyed: fd=78
08-22 16:11:44.833 D/ViewRootImpl@3d4ed51MainActivity: MSG_RESIZED_REPORT: frame=Rect(0, 0 - 720, 1480) ci=Rect(0, 48 - 0, 96) vi=Rect(0, 48 - 0, 96) or=1
08-22 16:11:44.857 D/ViewRootImpl@205fb95SplashActivity: Surface release. android.view.WindowManagerGlobal.setStoppedState:669 android.app.Activity.performStop:7649 android.app.ActivityThread.callActivityOnStop:4358 android.app.ActivityThread.performStopActivityInner:4336 android.app.ActivityThread.handleStopActivity:4411 android.app.servertransaction.TransactionExecutor.performLifecycleSequence:192 android.app.servertransaction.TransactionExecutor.cycleToPath:165 android.app.servertransaction.TransactionExecutor.executeLifecycleState:142
System.NullReferenceException: 'Object reference not set to an instance of an object.'


Original Comments

Visual Studio Feedback System on 8/22/2019, 11:24 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Visual Studio Feedback System on 8/23/2019, 10:11 AM:

This issue is currently being investigated. Our team will get back to you if either more information is needed, a workaround is available, or the issue is resolved.

Visual Studio Feedback System on 8/27/2019, 06:01 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.


Original Solutions

(no solutions)

4.2.0 3 help wanted high regression Android bug up-for-grabs

Most helpful comment

This only seems to happen when using a splash screen activity, and only if that activity is a FormsAppCompatActivity.

The repro project does work fine on 4.1, so something has regressed.

@tstaa As a workaround until we get this fixed, you might consider making your SplashActivity derive from AppCompatActivity instead of FormsAppCompatActivity - that will prevent the crash.

All 8 comments

Can you please attach a small project that demonstrates this issue? Thanks!

might be related to the regression we fixed this week

Same problem here (beta-4.3.0-pre2.1), it throws NullReferenceException at the following line: https://github.com/xamarin/Xamarin.Forms/blob/ff63ef551d9b2b5736092eb48aaf954f54d63417/Xamarin.Forms.Platform.Android/AppCompat/Platform.cs#L491

canvas is null.

@tstaa Are you able to attach a small project that demonstrates this issue? Thanks!

@samhouts please see attached, contains two projects:
MyApp.Mobile: default visual studio template, little to no change.
MyApp.Mobile.Android: android project from a real project, with unnecessary files removed.

It may be the case of the project/directory structure, the project was created a while ago, the default template seems to be a bit different now.

XamarinCrashRepro.zip

This only seems to happen when using a splash screen activity, and only if that activity is a FormsAppCompatActivity.

The repro project does work fine on 4.1, so something has regressed.

@tstaa As a workaround until we get this fixed, you might consider making your SplashActivity derive from AppCompatActivity instead of FormsAppCompatActivity - that will prevent the crash.

@hartez the workaround worked, will keep an eye on this issue, will revert back once resolved, thank you.

The work around worked for me with the update to 4.2.0.815419 (issues still exists in this version) - thank you for the work around

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jassmith picture jassmith  路  69Comments

dan5602 picture dan5602  路  124Comments

hartez picture hartez  路  59Comments

Sebastian1989101 picture Sebastian1989101  路  59Comments

jassmith picture jassmith  路  199Comments