_This issue has been moved from a ticket on Developer Community._
What steps will reproduce the problem?
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.'
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.
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.
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.
(no solutions)
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.
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
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
SplashActivityderive fromAppCompatActivityinstead ofFormsAppCompatActivity- that will prevent the crash.