dotnet/maui · critical · InvalidOperationException
You MUST invoke LoadApplication () before calling base.Finis
Error message
You MUST invoke LoadApplication () before calling base.FinishedLaunching ()
What it means
FormsApplicationDelegate.FinishedLaunching throws InvalidOperationException("You MUST invoke LoadApplication() before calling base.FinishedLaunching()") when _application is null. The AppDelegate contract requires LoadApplication(Application) to be called in FinishedLaunching before the base, otherwise the platform has no Xamarin.Forms Application to display.
Source
Thrown at src/Compatibility/Core/src/iOS/FormsApplicationDelegate.cs:57
// now in background
public override void DidEnterBackground(UIApplication uiApplication)
{
// applicationDidEnterBackground
}
// finish initialization before display to user
public override bool FinishedLaunching(UIApplication uiApplication, NSDictionary launchOptions)
{
// check contents of launch options and evaluate why the app was launched and respond
// initialize the important data structures
// prepare you apps window and views for display
// keep lightweight, anything long winded should be executed asynchronously on a secondary thread.
// application:didFinishLaunchingWithOptions
if (Window == null)
Window = new UIWindow(UIScreen.MainScreen.Bounds);
if (_application == null)
throw new InvalidOperationException("You MUST invoke LoadApplication () before calling base.FinishedLaunching ()");
SetMainPage();
_application.SendStart();
return true;
}
// about to become foreground, last minute preparatuin
public override void OnActivated(UIApplication uiApplication)
{
// applicationDidBecomeActive
// execute any OpenGL ES drawing calls
if (_application != null && _isSuspended)
{
_isSuspended = false;
CultureInfo.CurrentCulture.ClearCachedData();
TimeZoneInfo.ClearCachedData();
_application.SendResume();
}View on GitHub (pinned to f377ff1c5e)
Solutions
- Call LoadApplication(new App()) inside FinishedLaunching before base.FinishedLaunching.
- Verify the call order: LoadApplication first, then return base.FinishedLaunching(...).
- Check the AppDelegate for accidental early returns.
Example fix
// before
public override bool FinishedLaunching(UIApplication app, NSDictionary opts)
=> base.FinishedLaunching(app, opts);
// after
public override bool FinishedLaunching(UIApplication app, NSDictionary opts)
{
LoadApplication(new App());
return base.FinishedLaunching(app, opts);
} Defensive patterns
Strategy: validation
Validate before calling
// In FinishedLaunching:
if (_application == null)
LoadApplication(new App());
return base.FinishedLaunching(app, options); Prevention
- Always call LoadApplication before base.FinishedLaunching.
- Order: Forms.Init() -> LoadApplication() -> base.FinishedLaunching().
- Scaffold iOS projects from the Forms template to avoid missing calls.
When it happens
Trigger: Overriding FinishedLaunching in a custom AppDelegate and calling base.FinishedLaunching before (or without) calling LoadApplication(new App()); forgetting the LoadApplication call entirely.
Common situations: New iOS project scaffolding where the LoadApplication line was removed; refactoring FinishedLaunching and reordering base.Load; copy-paste from a non-Forms template.
Related errors
- application
- call Forms.Init() before this
- Implement INativeElementView on cell renderer: {ContentCell.
- No UIViewController found to present.
- InsertPageBefore is not supported globally on iOS, please us
AI-assisted analysis of dotnet/maui@f377ff1c5e (2026-08-13).
Data as JSON: /api/errors/64ef0d7d6c84fa14.
Report an issue: GitHub.