> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XGameUiShowErrorDialogAsync

> XGameUiShowErrorDialogAsync

# XGameUiShowErrorDialogAsync

为指定的错误代码显示带有服务定义的错误字符串的错误对话框的 UI。

## 语法

```cpp theme={null}
HRESULT XGameUiShowErrorDialogAsync(  
         XAsyncBlock* async,  
         HRESULT errorCode,  
         const char* context  
)  
```

### 参数

*async*   \_In\_<br />类型：[XAsyncBlock\*](/reference/system/xasync/structs/xasyncblock)

指向传递给 [XAsyncRun](/reference/system/xasync/functions/xasyncrun) 的 [XAsyncBlock](/reference/system/xasync/structs/xasyncblock) 的指针。

*errorCode*   \_In\_<br />类型：HRESULT

要显示 UI 的错误代码。

*context*   \_In\_opt\_<br />类型：char\*

要显示的错误的服务定义错误字符串。

### 返回值

类型：HRESULT

异步调用的 HRESULT 成功或错误代码。

## 备注

对话框上可能会出现其他按钮，例如“报告问题”，用于 XBOX Insider 报告错误。

当用户关闭错误对话框时，异步操作完成。

调用 UI 将使游戏进入\_受限模式\_。在受限模式下，当你的游戏处于所调用 UI 的后台时，它将获得较少的系统资源。若要详细了解受限模式和游戏的其他运行模式，请阅读 [XBOX 游戏生命周期（NDA 主题）](/build/console-features/console-workflows/xbox-game-life-cycle)。

## 要求

**标头：** XGameUI.h

**库：** xgameruntime.lib

**支持的平台：** Windows、Steam Deck、XBOX One 系列主机和 XBOX Series 主机

## 另请参阅

[XGameUI](/reference/system/xgameui/xgameui_members)<br />[XGameUIShowErrorDialogResult](/reference/system/xgameui/functions/xgameuishowerrordialogresult)<br />[XBOX 游戏生命周期（NDA 主题）](/build/console-features/console-workflows/xbox-game-life-cycle)


## Related topics

- [XGameUiShowErrorDialogResult](/zh-CN/reference/system/xgameui/functions/xgameuishowerrordialogresult.md)
- [XGameUiShowErrorDialogUiCallback](/zh-CN/reference/system/xgameui/functions/xgameuishowerrordialoguicallback.md)
- [XGameUiSetErrorDialogUiResponse](/zh-CN/reference/system/xgameui/functions/xgameuiseterrordialoguiresponse.md)
- [XGameUiUiCallbacks](/zh-CN/reference/system/xgameui/structs/xgameuiuicallbacks.md)
- [XGameUI](/zh-CN/reference/system/xgameui/xgameui_members.md)
