Caliburn.Micro (.WP7) und Bing Maps Crashing
-
12-10-2019 - |
Frage
Ich habe eine app, dass ich ein Upgrade von einigen Beta-Bits - und mein Kartenbildschirm abstürzt. So zu versuchen, auf den Grund, es zu bekommen - ich begann eine völlig neue - blank „Win Phone Application“.
referenzierten Caliburn.Micro (nur aus dem neuen Code letzte Nacht gebaut) Version: caliburnmicro_1296ea635677 (von Codeplex)
verwiesen Microsoft.phone.controls.map.dll
und in der Mainpage Ich habe
<Grid>
<Maps:Map />
</Grid>
und ich fügen Sie eine Bootstrap-Programm zu app.xaml
<WP7:PhoneBootStrapper x:Name="bootstrapper" />
, wenn die Seite läuft im Telefon Emulator - die Hauptseite macht und ich sehe eine Karte der Welt. wenn ich irgendwo auf der Seite klicken - ich eine nicht behandelte Ausnahme erhalten von „Der Parameter ist falsch“
, wenn ich die
entfernen
vom app.xaml - arbeitet die Karte korrekt.
Was denken Sie?
Vielen Dank für jede Beratung?
Lösung
Ich habe die Antwort gefunden.
Der Schlüssel hier - ist, dass ich dieses Setup hatte und wroking mit den Beta-Vorlagen -. Und es funktioniert nicht, wenn ich auf die WinPhone RTM Vorlagen in VS2010 bewegte
Caliburn hat einige Arbeit in meinem Namen, die „added“ auf die RTM-Vorlagen wurde -, die miteinander in Konflikt wurden. Am Ende dieses Problem nichts hat / hat mit der Bing Maps Kontrolle zu tun - es passiert einfach so, dass - das ist mein erster Bildschirm war -. So, dass, wo ich das Problem zu lösen versuche,
Dies war das immer so Nicht-Hilfreiche Ausnahme:
The parameter is incorrect
Which, bin ich ziemlich sicher, dass auf jedem Bildschirm passieren würde - wenn Sie den Upgrade-Pfad von Vorlagen ging, wie ich es tat. Also hier ist, was ich entfernen musste - alles wieder normal zu bekommen. In der neuen App.xaml.cs - ich entfernt (durch Kommentierung) im App Ctor ...
// Phone-specific initialization
// InitializePhoneApplication();
// Global handler for uncaught exceptions.
// UnhandledException += Application_UnhandledException;
Und dann nahm ich diese Methode Körper, weil sie nur von totem Code ist nach der InitializePhoneApplication () Aufruf von Ctor ...
Entfernen// Code to execute when the application is launching (eg, from Start)
// This code will not execute when the application is reactivated
private void Application_Launching(object sender, LaunchingEventArgs e)
{
}
// Code to execute when the application is activated (brought to foreground)
// This code will not execute when the application is first launched
private void Application_Activated(object sender, ActivatedEventArgs e)
{
}
// Code to execute when the application is deactivated (sent to background)
// This code will not execute when the application is closing
private void Application_Deactivated(object sender, DeactivatedEventArgs e)
{
}
// Code to execute when the application is closing (eg, user hit Back)
// This code will not execute when the application is deactivated
private void Application_Closing(object sender, ClosingEventArgs e)
{
}
// Code to execute if a navigation fails
private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
{
if (System.Diagnostics.Debugger.IsAttached)
{
// A navigation has failed; break into the debugger
System.Diagnostics.Debugger.Break();
}
}
// Code to execute on Unhandled Exceptions
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
if (System.Diagnostics.Debugger.IsAttached)
{
// An unhandled exception has occurred; break into the debugger
System.Diagnostics.Debugger.Break();
}
}
#region Phone application initialization
// Avoid double-initialization
private bool phoneApplicationInitialized = false;
// Do not add any additional code to this method
private void InitializePhoneApplication()
{
if (phoneApplicationInitialized)
return;
// Create the frame but don't set it as RootVisual yet; this allows the splash
// screen to remain active until the application is ready to render.
RootFrame = new PhoneApplicationFrame();
RootFrame.Navigated += CompleteInitializePhoneApplication;
// Handle navigation failures
RootFrame.NavigationFailed += RootFrame_NavigationFailed;
// Ensure we don't initialize again
phoneApplicationInitialized = true;
}
// Do not add any additional code to this method
private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e)
{
// Set the root visual to allow the application to render
if (RootVisual != RootFrame)
RootVisual = RootFrame;
// Remove this handler since it is no longer needed
RootFrame.Navigated -= CompleteInitializePhoneApplication;
}
#endregion
Besonderer Dank Rob für seine Hilfe dieses Rätsel zu lösen!