Crash after updating to 3.3 Stable. In Forms + Mac, changing Applications Main Page crashes. Working in 3.2
Steps for regression crash
var myApp = (App)Xamarin.Forms.Application.Current;
myApp.MainPage = new MainPage();
Specified page must be visible and application continues to work.
CRASH<<
Basic Information
I investigated
Breaking commit: cceee9ded6c8cadb19eb547f72d03c6c14230058
Remove it, and all will work properly
#if __MACOS__
public override NativeView NextKeyView {
get {
return FocusSearch (forwardDirection: true) ?? base.NextKeyView;
}
set {
if (value != null) // setting the value to null throws an exception
base.NextKeyView = value;
}
}
public override NativeView PreviousKeyView {
get {
return FocusSearch (forwardDirection: false) ?? base.PreviousKeyView;
}
}
#else
This is strange, but if you preserve only one property (return base value) and remove another
public override NativeView PreviousKeyView {
get {
return base.PreviousKeyView;
}
}
It will continue crash the app
As I undersand, app tries to use disposed views.
Release notes of 3.3.0.967583 says this issue is fixed --> Release Notes
It still crashes with error
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
at (wrapper managed-to-native) AppKit.NSApplication.NSApplicationMain(int,string[])
at AppKit.NSApplication.Main (System.String[] args) [0x00040] in /Library/Frameworks/Xamarin.Mac.framework/Versions/5.0.0.0/src/Xamarin.Mac/AppKit/NSApplication.cs:100
Any dependent issues pending?
Repro steps on vCurrent (3.4.0)
:
SwapRoot - ContentPage
twice or moreYes please and thank you for reopening. Looks very similar to #4300.
Same trouble with NullReferenceException in AppKit.NSApplication.NSApplicationMain in Xamarin.Forms 3.3, 3.4 and 4.0 pre1 on Mac.
3.2 works fine.
In my case the exception happens whenever Xamarin.Forms animation is triggered, other parts of my app seem to work fine.
4.0 prerelease has this issue as well. Can't build any apps with more than 1 page.
Same thing happens when changing masterDetailPage.Detail to a new page.
macOS page navigation is completely nonfunctional.
Don't know if anyone is seriously looking into the same.
A blocking issue not attended for more than 60 days.
Any ETA on this release?
@samhouts can we have an ETA on this please?
It's close to 90 days now... especially a blocking issue like this.
Great to see the issue In Progress! Be sure to test on Mojave. It was after the update to Mojave and XF3.3 that I started having blocking issues, including this one, on MacOS.
Circling back...great to have this fix, and it works!
Latest update worked! Good work!
This is still happening on Xamarin.Forms 4.0 pre9. I reverted to 3.6 and was able to continue for now.
@samhouts this is still present in Xamarin.Forms 4.0.0 final release. I had to downgrade to 3.6.0 again.
@DeerSteak Thanks for the new issue! This one is specifically for MacOS, so I don't believe it is related. We'll take a look at your issue on 6244.
Same here, changing MainPage in Xamarin.Forms.Application makes the MacOS app crash.
I first downgraded Xamarin.Forms from 4.0.0.49... to 3.6.0.34... and it was still crashing.
Then I downgraded Xamarin.Forms on the common library too, and it worked.
Most helpful comment
Same trouble with NullReferenceException in AppKit.NSApplication.NSApplicationMain in Xamarin.Forms 3.3, 3.4 and 4.0 pre1 on Mac.
3.2 works fine.
In my case the exception happens whenever Xamarin.Forms animation is triggered, other parts of my app seem to work fine.