Taritsyn / JavaScriptEngineSwitcher

JavaScript Engine Switcher determines unified interface for access to the basic features of popular JavaScript engines. This library allows you to quickly and easily switch to using of another JavaScript engine.
Apache License 2.0
440 stars 49 forks source link

V8 config can be null #12

Closed Daniel15 closed 9 years ago

Daniel15 commented 9 years ago

GetV8Configuration returns the value of ConfigurationManager.GetSection("jsEngineSwitcher/v8"). If this configuration section is not in the Web.config or App.config, this returns null, resulting in a NullReferenceException in V8JsEngine's constructor:

image

Taritsyn commented 9 years ago

During installation of JavaScriptEngineSwitcher.V8 package the jsEngineSwitcher/v8 configuration section is automatically added to configuration file (Web.config or App.config).

Daniel15 commented 9 years ago

True, but it should still handle the case of the config being null (eg. If I manually install it rather than using the NuGet package).

Sent from my mobile. On Apr 12, 2015 9:01 AM, "Andrey Taritsyn" notifications@github.com wrote:

During installation of JavaScriptEngineSwitcher.V8 package the jsEngineSwitcher/v8 configuration section is automatically added to configuration file (Web.config or App.config).

Reply to this email directly or view it on GitHub https://github.com/Taritsyn/JavaScriptEngineSwitcher/issues/12#issuecomment-92083497 .

Taritsyn commented 9 years ago

If config being null, then will not work a JsEngineSwitcher.Current.CreateDefaultJsEngineInstance method.

Daniel15 commented 9 years ago

True - However you can still create a V8 engine through new V8JsEngine(), which will crash with a NullReferenceException. The constructor should handle if v8Config is null.

Taritsyn commented 9 years ago

OK. In next release I will fix this error.

Taritsyn commented 9 years ago

In the JavaScriptEngineSwitcher.V8 version 1.2.6 was fixed this error.