public override IPrecompiledScript PrecompileFile(string path, Encoding encoding = null) { VerifyNotDisposed(); if (path == null) { throw new ArgumentNullException( nameof(path), string.Format(CoreStrings.Common_ArgumentIsNull, nameof(path)) ); } if (string.IsNullOrWhiteSpace(path)) { throw new ArgumentException( string.Format(CoreStrings.Common_ArgumentIsEmpty, nameof(path)), nameof(path) ); } if (!ValidationHelpers.CheckDocumentNameFormat(path)) { throw new ArgumentException( string.Format(CoreStrings.Usage_InvalidFileNameFormat, path), nameof(path) ); } OriginalPrecompiledScript precompiledScript; try { precompiledScript = _jsEngine.PrecompileFile(path, encoding); } catch (OriginalException e) { throw WrapJsException(e); } catch (FileNotFoundException) { throw; } return(new MsiePrecompiledScript(precompiledScript)); }