【问题标题】:UWP - A debugger is attached to .exe but not configuredUWP - 调试器附加到 .exe 但未配置
【发布时间】:2017-06-14 14:53:40
【问题描述】:

我正在开发 Windows 应用商店应用程序 (UWP),但本机代码有问题 - 我收到此消息。

此代码在第二次或第三次触发后抛出此异常。

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 打开,一切正常但我不知道出了什么问题。此异常在不同时间后,在不同时间的页面打开和关闭后引发。我不知道出了什么问题。

UPDProjectionViewPage 具有MediaElement 控件时会出现问题。

【问题讨论】:

    标签: c# windows-runtime windows-store-apps


    【解决方案1】:

    您需要将调试器类型从仅托管(默认)更改为混合。它不会修复您的异常,但至少您现在可以使用调试器对其进行跟踪:)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-07-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-26
      相关资源
      最近更新 更多