We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

Debug

Non-standard. Do not use!
The Debug object only works in Internet Explorer and Windows 8 and Windows Phone 8.1 Store apps.

An instrinsic global object that sends output to a debugger.

Syntax

You do not instantiate the Debug object. Its properties and methods are called off the Debug class.

There are different ways to debug Internet Explorer and Windows 8.x Store apps. In Windows 8.x Store apps, the write and writeln functions of the Debug object display strings in the Visual Studio Output window at run time.

To debug Internet Explorer scripts, you must have a script debugger installed and the script must run in debug mode. Internet Explorer 8 and later versions include the JavaScript debugger.

If the script is not being debugged, the Debug methods and properties have no effect.

Constants

Async Callback Status Codes

Contant Description Value
Debug.MS_ASYNC_CALLBACK_STATUS_ASSIGN_DELEGATE The synchronous work item assigned a callback or continuation to be run by an asynchronous operation. 0
Debug.MS_ASYNC_CALLBACK_STATUS_JOIN The synchronous work item satisfied part of a join asynchronous operation. 1
Debug.MS_ASYNC_CALLBACK_STATUS_CHOOSEANY The synchronous work item satisfied a choice asynchronous operation. 2
Debug.MS_ASYNC_CALLBACK_STATUS_CANCEL The synchronous work item was canceled. 3
Debug.MS_ASYNC_CALLBACK_STATUS_ERROR The synchronous work item caused an error in an asynchronous operation. 4

Async Operation Status Codes

Contant Description Value
Debug.MS_ASYNC_OP_STATUS_SUCCESS The asynchronous operation was successful. 1
Debug.MS_ASYNC_OP_STATUS_CANCELED The asynchronous operation was canceled. 2
Debug.MS_ASYNC_OP_STATUS_ERROR The asynchronous operation resulted in an error. 3

Properties

Debug.debuggerEnabled
Determines whether debugging is enabled for the script context. Debugging may be enabled or disabled whether or not a debugger is attached.
Debug.setNonUserCodeExceptions
Determines whether any try-catch blocks in this scope are to be treated by the debugger as user-unhandled.

Functions

Debug.msTraceAsyncCallbackCompleted
Indicates that the callback stack associated with a previously specified asynchronous operation has completed.
Debug.msTraceAsyncCallbackStarting
Associates the callback stack with a previously specified asynchronous operation.
Debug.msTraceAsyncOperationCompleted
Indicates that an asynchronous operation has completed.
Debug.msTraceAsyncOperationStarting
Initiates a trace for an asynchronous operation.
Debug.msUpdateAsyncCallbackRelation
Updates the relationship status between a synchronous work item and the associated asynchronous operation.
Debug.write
Sends strings to the script debugger.
Debug.writeln
Sends strings to the script debugger, followed by a newline character.

Examples

This example uses the write function to display the value of the variable.

var counter = 42;  
Debug.write("The value of counter is " + counter);

Requirements

Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also supported in Store apps (Windows 8 and Windows Phone 8.1).

See also

Document Tags and Contributors

Contributors to this page: erikadoyle
Last updated by: erikadoyle,