TraceManager.StopAsync Method

Stops a trace asynchronously.

Syntax

public:
static IAsyncOperation<TraceResult>^ StopAsync()  

Return value

Type: IAsyncOperation<TraceResult

Returns an IAsyncOperation<Microsoft.Xbox.Tools.ConsoleExtensions.TraceResult> object that represents the state of the asynchronous operation. Upon successful completion the resulting TraceResult objects contains information about the trace.

Remarks

After the trace has stopped, the resulting trace file will be available in the xbTrace directory of the SystemScratch drive (typically accessed as d:\xbTrace) on the console. The trace files can be copied back to the PC using either xbcp or Xbox One Neighborhood. Trace files are assigned unique names based on timestamp.

If stopAsync is called when no trace is running, the call will succeed but the value of TraceResult.errorCode will be 0x8000000d “An illegal state change was requested.”

Example

    
var XtfTraceManager = Microsoft.Xbox.Tools.ConsoleExtensions.TraceManager;
XtfTraceManager.stopAsync().then(

    function complete(result) {
        // Handle success here 
        var logText = "TraceManager.stopAsync succeeded";

        writeLog("TraceManager.stopAsync succeeded");
        writeLog(result.type.toString());
        writeLog(result.Duration.duration.toString());

        // The filePath property contains the name of the resulting trace file on the 
        // console’s d: drive
        writeLog(result.filePath.toString());
        writeLog(result.eventsLost.toString());
        // If no trace is running when stopAsync is called the error code will be 0x8000000d "An illegal state change was requested."                  
        writeLog(result.errorCode.toString());
    }.bind(this),

    function error(e) {
        // Handle error here 
        writeError("TraceManager.stopAsync error", result.errorCode.toString());
    }.bind(this)
);  

C++

Microsoft::Xbox::Tools::ConsoleExtensions::TraceManager::StopAsync()->Completed =
ref new Windows::Foundation::AsyncOperationCompletedHandler<Microsoft::Xbox::Tools::ConsoleExtensions::TraceResult^>
( [ this ] ( Windows::Foundation::IAsyncOperation<Microsoft::Xbox::Tools::ConsoleExtensions::TraceResult^>^ action, Windows::Foundation::AsyncStatus asyncStatus )
{
  if( asyncStatus == Windows::Foundation::AsyncStatus::Completed )
  {
    Microsoft::Xbox::Tools::ConsoleExtensions::TraceResult^ traceResult = action->GetResults();
    OutputDebugStringW(L"ERA Console API call succeeded: TraceManager::StopAsync\r\n");
    OutputDebugStringW(traceResult->Duration.Duration.ToString()->Data());
    OutputDebugStringW(L"\r\n");
    OutputDebugStringW(traceResult->ErrorCode.Value.ToString()->Data());
    OutputDebugStringW(L"\r\n");
    OutputDebugStringW(traceResult->EventsLost.ToString()->Data());
    OutputDebugStringW(L"\r\n");
    OutputDebugStringW(traceResult->FilePath->Data());
    OutputDebugStringW(L"\r\n");
  }
  else
  {
    OutputDebugStringW(L"ERA Console API call failed: TraceManager::StopAsync\r\n");
  }
});  

Requirements

Namespace: Microsoft.Xbox.Tools.ConsoleExtensions

Metadata: microsoft.xbox.tools.consoleextensions.winmd

See also

Reference

TraceManager Class

TraceManager Members

Microsoft.Xbox.Tools.ConsoleExtensions Namespace