TraceManager.StartAsync Method

Starts a trace asynchronously.

Syntax

public:
static IAsyncAction^ StartAsync(
         TraceType traceType
)  

Parameters

traceType
Type: TraceType 

The type of trace to start.

Return value

Type: IAsyncAction 

Returns an IAsyncAction object that represents the state of the asynchronous operation.

Remarks

Only one trace may be running at any given time. If startAsync is called when a trace is running, the error code 0x8000000d “An illegal state change was requested.” will be returned.

Traces started with a TraceType of AdvancedMultiplayer require an exclusive resource title to be running because some of the logs that are gathered come from the Exclusive Resource partition. If an exclusive resource title is not running, StartAsync will return an error with code 0x8007139f indicating that the system is not in a state in which a trace can be taken.

Example

var XtfTraceManager = Microsoft.Xbox.Tools.ConsoleExtensions.TraceManager;        
var traceType = Microsoft.Xbox.Tools.ConsoleExtensions.TraceType.networkPacket;

XtfTraceManager.startAsync(traceType).then(
    function complete() {
        // Handle success here 
        writeLog("TraceManager.startAsync succeeded");
    }.bind(this),

    function error(e) {
        // If e is “An illegal state change was requested” a trace was already running when startAsync was called 
        writeError("TraceManager.startAsync error: ", e);
    }.bind(this)
);  

C++

Microsoft::Xbox::Tools::ConsoleExtensions::TraceManager::StartAsync(Microsoft::Xbox::Tools::ConsoleExtensions::TraceType::NetworkPacket)->Completed =
ref new Windows::Foundation::AsyncActionCompletedHandler([ this ] ( Windows::Foundation::IAsyncAction^ action, Windows::Foundation::AsyncStatus asyncStatus )
{
  if( asyncStatus == Windows::Foundation::AsyncStatus::Completed )
  {
    OutputDebugStringW(L"ERA Console API call succeeded: TraceManager::StartAsync\r\n");
  }
  else
  {
    // if start failed, skip the stop test because it doesn't make any sense to try it
    OutputDebugStringW(L"ERA Console API call failed: TraceManager::StartAsync\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