2016-05-22 13 views
1

Windowsストアアプリケーション(UWP)を開発中で、ネイティブコードに問題があります。 enter image description hereUWP - .exeにデバッガが接続されていますが、設定されていません。

この例外は、このコードが2回目または3回目に発生した後にスローされます。

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が開きますが、何が問題なのかわかりません。この例外は、異なる時間の後に、ページの異なる時間を開いたり閉じたりした後にスローされます。私は何がうまくいかないのか分かりません。 ProjectionViewPageMediaElement制御しているとき

UPD 問題が発生します。

答えて

3

デバッガの種類を[管理対象のみ](デフォルト)から[混合]に変更する必要があります。それはあなたの例外を修正しませんが、少なくとも、あなたは:)

enter image description here

0

は、デバッグオプションに、あなたのプロジェクトのプロパティを移動し、管理のみからデバッガの種類を変更し、今デバッガでそれをトレースすることができます混合(管理され、ネイティブ)。

関連する問題