Ich entwickle Windows Store App (UWP) und ich habe ein Problem mit nativem Code - ich habe diese Nachricht. UWP - Ein Debugger ist an .exe angehängt, aber nicht konfiguriert
Dieser Ausnahmewurf nach diesem Code wurde zum zweiten oder dritten Mal ausgelöst.
if(ProjectionManager.ProjectionDisplayAvailable)
{
if(init != null)
{
init.ProjectionViewPageControl.StartViewInUse();
await ProjectionManager.StopProjectingAsync(MainPage.SecondaryViewId, thisViewId);
init.ProjectionViewPageControl.StopViewInUse();
rootPage.ProjectionViewPageControl = null;
}
if(rootPage.ProjectionViewPageControl == null)
{
//First, create a new, blank view
var thisDispatcher = Window.Current.Dispatcher;
await CoreApplication.CreateNewView().Dispatcher.RunAsync(CoreDispatcherPriority.Normal,() =>
{
rootPage.ProjectionViewPageControl = ViewLifetimeControl.CreateForCurrentView(); //ViewLifetimeControl is a wrapper to make sure the view is closed only when the app is done with it
//Assemble some data necessary for the new page
init = new ProjectionViewPageInitializationData();
init.MainDispatcher = thisDispatcher;
init.ProjectionViewPageControl = rootPage.ProjectionViewPageControl;
init.MainViewId = thisViewId;
//Note that the view will not become visible until "StartProjectingAsync" is called
var rootFrame = new Frame();
rootFrame.Navigate(typeof(ProjectionViewPage), init);
Window.Current.Content = rootFrame;
Window.Current.Activate();
});
}
try
{
rootPage.ProjectionViewPageControl.StartViewInUse(); // Start/StopViewInUse are used to signal that the app is interacting with the view, so it shouldn't be closed yet, even if the user loses access to it
await ProjectionManager.StartProjectingAsync(rootPage.ProjectionViewPageControl.Id, thisViewId); // Show the view on a second display (if available) or on the primary display
rootPage.ProjectionViewPageControl.StopViewInUse();
}
catch { }
}
ProjectionViewPage
öffnet, alles funktioniert, aber ich weiß nicht, was los ist. Diese Ausnahme wird zu unterschiedlichen Zeiten nach dem Öffnen und Schließen der Seite ausgelöst. Ich habe keine Ahnung, was schief läuft.
UPD Problem tritt auf, wenn ProjectionViewPage
MediaElement
Kontrolle hat.