Help.ShowForError Method

Launches the Help app to assist the user in understanding or troubleshooting an error that the app encountered.

Syntax

public:
static IAsyncAction^ ShowForError(
         String^ contextId,
         String^ errorId
)  

Parameters

contextId
Type: String 

  Application context within which the error occurred. The context string (the contextId parameter) allows an app to provide an app-defined string that identifies the context the user is in. The context string is passed as postdata to the Help service for logging purposes.

errorId
Type: String 

  String representation of the error code. For example, “0x80004005”.

Return value

Type: IAsyncAction 

Interface for tracking the progress of the asynchronous call. Can be used by the calling app to confirm success. This async operation enables you to use .then() semantics in JavaScript, or lambdas in C++ or C#.

Remarks

ShowForError launches the Help app, which will assist the user in understanding or troubleshooting an error that the app encountered but did not handle.

Error assistance is independent of the app’s Help manual, and the Help app will attempt to find helpful information for the user based on the error code reported. The context string (the contextId parameter) allows an app to provide an app-defined string that identifies the context the user is in. The context string is passed as post data to the Help service for logging purposes.

The error code specified in errorId is a hexadecimal string representation of the specific error code that was encountered. For example, “0x80004005”. For known errors, the Help app will display specific help and troubleshooting information. For unknown errors, it will display general help information.

contextId is an app-defined string that specifies the context or location in the application where the error occurred. contextId is used for internal logging purposes. Appropriate values might be the application module or function, or sections as reported in the SectionStart and SectionEnd XCE events.

Example

C++

using namespace Windows::Foundation;

// Show help for an unhandled error
void ShowErrorHelp(PWSTR appContext, HRESULT hr)
{
    WCHAR buf[20];
    swprintf(buf, _countof(buf), L"0x%08x", hr);
    Platform::String^ context = ref new Platform::String(appContext);
    Platform::String^ error = ref new Platform::String(buf);

    IAsyncAction^ helpAction = Windows::Xbox::ApplicationModel::Help::ShowForError(context, error);

    // Optionally, specify a completion handler.
    helpAction->Completed = ref new AsyncActionCompletedHandler(
        [](IAsyncAction^ action, Windows::Foundation::AsyncStatus status)
        {
            // help has launched
        });
}  
function showErrorHelp(appContext, errorCode) {
    if (Windows.Xbox) {
        Windows.Xbox.ApplicationModel.Help.showForError(
            appContext,
            "0x" + errorCode.toString(16)
            ).then(
                function () {
                    // help has launched
                });
    }
}  

Requirements

Namespace: Windows.Xbox.ApplicationModel

Metadata: windows.winmd

See also

Displaying Help

Reference

Help Class

Help Members

Windows.Xbox.ApplicationModel Namespace

Help.Show Method