Taritsyn edited this page Dec 25, 2018 · 2 revisions

JavaScriptEngineSwitcher.Msie contains adapter MsieJsEngine (wrapper for the MSIE JavaScript Engine for .NET).

For correct working of the MSIE JavaScript Engine it is recommended to install Internet Explorer 9+ or Microsoft Edge on the machine.

Engine settings

You can specify a settings of JS engine during its registration:

engineSwitcher.EngineFactories
	.AddMsie(new MsieSettings
	{
		EngineMode = JsEngineMode.ChakraIeJsRt
	})
	;

If you manually create an instance of JS engine, then you can pass settings via the constructor:

IJsEngine engine = new MsieJsEngine(
	new MsieSettings
	{
		EngineMode = JsEngineMode.ChakraIeJsRt
	}
);

Consider in detail properties of the MsieSettings class:

Property name Data type Default value Description
EnableDebugging Boolean false Flag for whether to allow debugging in Visual Studio by adding the debugger statement to script code.
EngineMode JsEngineMode enumeration Auto JS engine mode. Can take the following values:
  • Auto. Automatically selects the most modern JavaScript engine from available on the machine.
  • Classic. Classic MSIE JavaScript engine (supports ECMAScript 3 with possibility of using the ECMAScript 5 Polyfill and the JSON2 library). Requires Internet Explorer 6 or higher on the machine. Not supported in version for .NET Core.
  • ChakraActiveScript. ActiveScript version of Chakra JavaScript engine (supports ECMAScript 5). Requires Internet Explorer 9 or higher on the machine. Not supported in version for .NET Core.
  • ChakraIeJsRt. “IE” JsRT version of Chakra JavaScript engine (supports ECMAScript 5). Requires Internet Explorer 11 or Microsoft Edge on the machine.
  • ChakraEdgeJsRt. “Edge” JsRT version of Chakra JavaScript engine (supports ECMAScript 5). Requires Microsoft Edge on the machine.
MaxStackSize Int32 503 808 or 1 007 616

Maximum stack size in bytes.

Set a 0 to use the default maximum stack size specified in the header for the executable.

Not supported in version for .NET Core 1.X.

UseEcmaScript5Polyfill Boolean false Flag for whether to use the ECMAScript 5 Polyfill.
UseJson2Library Boolean false Flag for whether to use the JSON2 library

Debugging

MSIE JavaScript Engine for .NET has support of the debugging in Visual Studio 2010-2012. In addition, debuggable script must contain a debugger statement (see MSDN for more details).

Here are steps, that you need to do for start of debugging:

  1. Switch the solution in debug mode.

  2. Set the EnableDebugging property of the MsieSettings class to true.

  3. Add the debugger statements in debuggable script code.

  4. Click on the Start button.

  5. In opened the Visual Studio Just-In-Time Debugger window select the New instance of Microsoft Visual Studio 2012 item:

    “Visual Studio Just-In-Time Debugger” window

  6. In the Visual Studio debugger window open the script block(s) and set breakpoint(s):

    Setting of breakpoint in the script blocks

  7. Return to the main Visual Studio window and click on the Continue button.

    MSIE script debugging in Visual Studio 2012

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.