Xbox 開發人員計畫上的 UWP 已知問題Known issues with UWP on Xbox Developer Program

本主題說明 Xbox One 開發人員計畫上的 UWP 已知問題。This topic describes known issues with the UWP on Xbox One Developer Program. 如需此計畫的詳細資訊,請參閱 Xbox 上的 UWPFor more information about this program, see UWP on Xbox.

[如果您是從 API 參考主題中的連結,並正在尋找通用裝置系列 API 資訊,請參閱 Xbox 上不支援的 UWP 功能。][If you came here from a link in an API reference topic, and are looking for Universal device family API information, see UWP features not supported on Xbox.]

下列清單將針對您可能遇到的一些已知問題進行重點提示,但這並不是完整的清單。The following list highlights some known issues that you may encounter, but this list is not exhaustive.

我們想要您的意見反應,因此請在開發通用 Windows 平台應用程式 論壇上報告您發現的任何問題。We want to get your feedback, so please report any issues that you find on the Developing Universal Windows Platform apps forum.

如果您遇到困難,請閱讀本主題中的資訊、參閱常見問題集,並使用論壇以尋求協助。If you get stuck, read the information in this topic, see Frequently asked questions, and use the forums to ask for help.

家長監護開啟時,從 VS 進行部署將會失敗Deploying from VS fails with Parental Controls turned on

若主機開啟 [設定] 中的 [家長監護] 功能,從 VS 啟用應用程式將會失敗。Launching your app from VS will fail if the console has Parental Controls turned on in Settings.

若要解決此問題,可以先暫時停用家長監護,或:To work around this issue, either temporarily disable Parental Controls, or:

  1. 將應用程式部署到已關閉家長監護的主機。Deploy your app to the console with Parental Controls turned off.
  2. 開啟家長監護。Turn on Parental Controls.
  3. 從主機啟動應用程式。Launch your app from the console.
  4. 輸入 PIN 或密碼來允許啟動應用程式。Enter a PIN or password to allow the app to launch.
  5. 應用程式將會啟動。App will launch.
  6. 關閉應用程式。Close the app.
  7. 使用 F5 從 VS 啟動,應用程式將會以無提示方式啟動。Launch from VS using F5, and the app will launch with no prompting.

此時,除非您將應用程式卸載後再重新安裝,否則許可權會一直在 您將使用者 登出之前。At this point the permission is sticky until you sign the user out, even if you uninstall and reinstall the app.

有另外一種免除類型,僅適用於子女帳戶。There is another type of exemption that is only available for child accounts. 子女帳戶需要家長登入以授與權限,但當他們這樣做時,家者可以選擇 [一律] 允許子女啟動該應用程式。A child account requires a parent to sign in to grant permission, but when they do, the parent has the option of choosing to Always allow the child to launch the app. 該免除項目儲存於雲端,即使子女登出後又重新登入,也會保留。That exemption is stored in the cloud and will persist even if the child signs out and signs back in.

StorageFile.CopyAsync 無法將加密的檔案複製到未加密的目的地StorageFile.CopyAsync fails to copy encrypted files to unencrypted destination

使用 StorageFile.CopyAsync 將已加密檔案複製到沒有加密的目的地時,這個呼叫會失敗並發生下列例外狀況:When StorageFile.CopyAsync is used to copy a file that is encrypted to a destination that is not encrypted, the call will fail with the following exception:

System.UnauthorizedAccessException: Access is denied. (Excep_FromHResult 0x80070005)

這可能會影響想要將部署為應用程式套件一部分之檔案複製到其他位置的 Xbox 開發人員。This can affect Xbox developers who want to copy files that are deployed as part of their app package to another location. 之所以如此的原因是,Xbox 加密套件內容時所用的是零售模式,而不是開發人員模式。The reason for this is that the package contents are encrypted on an Xbox in retail mode, but not in Dev Mode. 因此,App 或許在開發和測試期間看起來會依預期正常運作,但是發佈並安裝至零售 Xbox 後,就會失敗。As a result, the app may appear to work as expected during development and testing, but then fail once it has been published and then installed to a retail Xbox.

Xbox One 上的已封鎖網路連接埠Blocked networking ports on Xbox One

Xbox One 裝置上的通用 Windows 平台 (UWP) 應用程式具有無法繫結至 [57344, 65535] (包含此項) 範圍中之連接埠的限制。Universal Windows Platform (UWP) apps on Xbox One devices are restricted from binding to ports in the range [57344, 65535], inclusive. 雖然於執行階段期間繫結至這些連接埠時,看起來可能已成功,不過網路流量在抵達應用程式之前可能便已無訊息地被捨棄。Although binding to these ports might appear to succeed at run-time, network traffic can be silently dropped before reaching your app. 您的應用程式應該在可行的情況下繫結至連接埠 0,這將能允許系統選取本機連接埠。Your app should bind to port 0 wherever possible, which allows the system to select the local port. 如果您需要使用特定的連接埠,連接埠號碼必須位於 [1025, 49151] 的範圍內,而您也應該檢查並避免與 IANA 登錄發生衝突。If you need to use a specific port, the port number must be in the range [1025, 49151], and you should check and avoid conflicts with the IANA registry. 如需詳細資訊,請參閱服務名稱與傳輸通訊協定連接埠號碼登錄 (英文)For more information, see the Service Name and Transport Protocol Port Number Registry.

Windows 執行階段 API 涵蓋範圍Windows Runtime API coverage

Xbox 上並不支援所有 Windows 執行階段 Api。Not all Windows Runtime APIs are supported on Xbox. 如需我們已知無法運作的 Api 清單,請參閱 Xbox 上不支援的 UWP 功能For the list of APIs that we know don't work, see UWP features not supported on Xbox. 如果您發現其他 API 問題,請在論壇上報告它們。If you find issues with other APIs, please report them on the forums.

您將收到有關所提供憑證的警告 (與下列螢幕擷取畫面類似),因為 Xbox One 主機所簽署的安全性憑證並不被視為已知的受信任發行者。You will receive a warning about the certificate that was provided, similar to the following screenshot, because the security certificate signed by your Xbox One console is not considered a well-known trusted publisher. 若要存取 Windows Device Portal,請按一下 [繼續瀏覽此網站]To access the Windows Device Portal, click Continue to this website.

網站安全性憑證警告

在 Xbox 上 KnownFolders.MediaServerDevices 附加說明KnownFolders.MediaServerDevices caveat on Xbox

在桌面上,媒體伺服器與電腦「搭配」,而裝置關聯服務會不斷地追蹤哪些伺服器目前在線上,如此,初始檔案系統查詢便可立即傳回目前在線上的已配對伺服器清單。On Desktop, media servers are “paired” with the PC, and the Device Association Service is constantly tracking which of the servers are currently on-line, so an initial file system query can immediately return a list of the paired servers that are currently online.

在 Xbox 上,沒有新增或移除伺服器的 UI,因此初始檔案系統查詢將永遠傳回空白。On Xbox, there is no UI to add or remove servers, so the initial file system query will always return empty. 您必須建立查詢,並訂閱至 ContentsChanged 事件,每當收到通知便重新整理查詢。You must create a query and subscribe to the ContentsChanged event and refresh the query each time you get a notification. 伺服器會魚貫而至,大部分在 3 秒鐘內即會被發現。Servers will trickle in and most will have been discovered within 3 seconds.

簡單的範例程式碼︰Simple example code:

namespace TestDNLA {

    public sealed partial class MainPage : Page {
        public MainPage() {
            this.InitializeComponent();
        }

        private async void FindFiles_Click(object sender, RoutedEventArgs e) {
            try {
                StorageFolder library = KnownFolders.MediaServerDevices;
                var folderQuery = library.CreateFolderQuery();
                folderQuery.ContentsChanged += FolderQuery_ContentsChanged;
                IReadOnlyList<StorageFolder> rootFolders = await folderQuery.GetFoldersAsync();
                if (rootFolders.Count == 0) {
                    Debug.WriteLine("No Folders found");
                } else {
                    Debug.WriteLine("Folders found");
                }
            } catch (Exception ex) {
                Debug.WriteLine("Error: " + ex.Message);
            } finally {
                Debug.WriteLine("Done");
            }
        }

        private async void FolderQuery_ContentsChanged(Windows.Storage.Search.IStorageQueryResultBase sender, object args) {
            Debug.WriteLine("Folder added " + sender.Folder.Name);
            IReadOnlyList<StorageFolder> topLevelFolders = await sender.Folder.GetFoldersAsync();
            foreach (StorageFolder topLevelFolder in topLevelFolders) {
                Debug.WriteLine(topLevelFolder.Name);
            }
        }
    }
}

另請參閱See also