Skip to content

Jurassic

Taritsyn edited this page Mar 28, 2021 · 13 revisions

JavaScriptEngineSwitcher.Jurassic contains adapter JurassicJsEngine (wrapper for the Jurassic version of March 19, 2021).

Engine settings

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

engineSwitcher.EngineFactories
	.AddJurassic(new JurassicSettings
	{
		StrictMode = true
	})
	;

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

IJsEngine engine = new JurassicJsEngine(
	new JurassicSettings
	{
		StrictMode = true
	}
);

Consider in detail properties of the JurassicSettings class:

Property name Data type Default value Description
EnableDebugging Boolean false

Flag for whether to enable script debugging features (allows a generation of debug information).

If this is set to true performance and memory usage are negatively impacted.

Not supported in version for .NET Core.

EnableIlAnalysis Boolean false Flag for whether to disassemble any generated IL and store it in the associated function.
EnableHostCollectionsEmbeddingByValue Boolean false

Flag for whether to enable conversion of host collections, that are passed or returned to script code, to script arrays.

This property does not allow the embedding of host collections by using a EmbedHostObject method, it only affects the internal mechanisms of the Jurassic library.

StrictMode Boolean false Flag for whether to allow run the script in strict mode.

Debugging

Jurassic has limited support of the debugging in Visual Studio 2010-2013. You can debug only scripts, that have been executed by using the ExecuteFile method. 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 JurassicSettings class to true.

  3. Add the debugger statements in debuggable scripts.

  4. Click on the Start button.

  5. In opened window(s) set breakpoint(s) in the script code.

  6. Click on the Continue button.

    Jurassic script debugging in Visual Studio 2013

See also same topic in the Jurassic documentation.

Known issues

Errors when accessing to the constants of embedded types.

Clone this wiki locally