public override IPrecompiledScript PrecompileResource(string resourceName, Type type)
        {
            VerifyNotDisposed();

            if (resourceName == null)
            {
                throw new ArgumentNullException(
                          nameof(resourceName),
                          string.Format(CoreStrings.Common_ArgumentIsNull, nameof(resourceName))
                          );
            }

            if (type == null)
            {
                throw new ArgumentNullException(
                          nameof(type),
                          string.Format(CoreStrings.Common_ArgumentIsNull, nameof(type))
                          );
            }

            if (string.IsNullOrWhiteSpace(resourceName))
            {
                throw new ArgumentException(
                          string.Format(CoreStrings.Common_ArgumentIsEmpty, nameof(resourceName)),
                          nameof(resourceName)
                          );
            }

            if (!ValidationHelpers.CheckDocumentNameFormat(resourceName))
            {
                throw new ArgumentException(
                          string.Format(CoreStrings.Usage_InvalidResourceNameFormat, resourceName),
                          nameof(resourceName)
                          );
            }

            OriginalPrecompiledScript precompiledScript;

            try
            {
                precompiledScript = _jsEngine.PrecompileResource(resourceName, type);
            }
            catch (OriginalException e)
            {
                throw WrapJsException(e);
            }
            catch (NullReferenceException)
            {
                throw;
            }

            return(new MsiePrecompiledScript(precompiledScript));
        }