Exemplo n.º 1
0
        internal override void CacheBuildResult(string cacheKey, BuildResult result,
                                                long hashCode, DateTime utcStart)
        {
            // If it should not be cached to disk, leave it alone
            if (!result.CacheToDisk)
            {
                return;
            }

            // VSWhidbey 564168 don't save to disk if already shutting down, otherwise we might
            // be persisting assembly that was compiled with obsolete references.
            // Since we are shutting down and not creating any cache, delete the compiled result
            // as it will not be used in future.
            if (HostingEnvironment.ShutdownInitiated)
            {
                BuildResultCompiledAssemblyBase compiledResult = result as BuildResultCompiledAssemblyBase;

                // DevDiv2 880034: check if ResultAssembly is null before calling GetName().
                // UsesExistingAssembly could be true in updatable compilation scenarios.
                if (compiledResult != null && compiledResult.ResultAssembly != null && !compiledResult.UsesExistingAssembly)
                {
                    MarkAssemblyAndRelatedFilesForDeletion(compiledResult.ResultAssembly.GetName().Name);
                }
                return;
            }

            string preservationFile    = GetPreservedDataFileName(cacheKey);
            PreservationFileWriter pfw = new PreservationFileWriter(PrecompilationMode);

            pfw.SaveBuildResultToFile(preservationFile, result, hashCode);
        }
Exemplo n.º 2
0
        internal override void SetPreservedAttributes(PreservationFileWriter pfw)
        {
            base.SetPreservedAttributes(pfw);
            string preservationFileName = this.GetPreservationFileName();

            pfw.SetAttribute("CCUpreservationFileName", preservationFileName);
            using (FileStream stream = File.Open(Path.Combine(HttpRuntime.CodegenDirInternal, preservationFileName), FileMode.Create))
            {
                BinaryFormatter formatter = new BinaryFormatter();
                if (this._codeCompileUnit != null)
                {
                    formatter.Serialize(stream, this._codeCompileUnit);
                }
                else
                {
                    formatter.Serialize(stream, new object());
                }
                formatter.Serialize(stream, this._codeDomProviderType);
                formatter.Serialize(stream, this._compilerParameters);
                if (this._linePragmasTable != null)
                {
                    formatter.Serialize(stream, this._linePragmasTable);
                }
                else
                {
                    formatter.Serialize(stream, new object());
                }
            }
        }
 internal override void SetPreservedAttributes(PreservationFileWriter pfw)
 {
     base.SetPreservedAttributes(pfw);
     string preservationFileName = this.GetPreservationFileName();
     pfw.SetAttribute("CCUpreservationFileName", preservationFileName);
     using (FileStream stream = File.Open(Path.Combine(HttpRuntime.CodegenDirInternal, preservationFileName), FileMode.Create))
     {
         BinaryFormatter formatter = new BinaryFormatter();
         if (this._codeCompileUnit != null)
         {
             formatter.Serialize(stream, this._codeCompileUnit);
         }
         else
         {
             formatter.Serialize(stream, new object());
         }
         formatter.Serialize(stream, this._codeDomProviderType);
         formatter.Serialize(stream, this._compilerParameters);
         if (this._linePragmasTable != null)
         {
             formatter.Serialize(stream, this._linePragmasTable);
         }
         else
         {
             formatter.Serialize(stream, new object());
         }
     }
 }
 internal virtual void SetPreservedAttributes(PreservationFileWriter pfw)
 {
     if (this.Flags != 0)
     {
         pfw.SetAttribute("flags", this.Flags.ToString("x", CultureInfo.InvariantCulture));
     }
 }
 internal override void SetPreservedAttributes(PreservationFileWriter pfw)
 {
     base.SetPreservedAttributes(pfw);
     if (this._appInitializeMethod != null)
     {
         pfw.SetAttribute("appInitializeClass", this._appInitializeMethod.ReflectedType.FullName);
     }
 }
 internal override void SetPreservedAttributes(PreservationFileWriter pfw)
 {
     base.SetPreservedAttributes(pfw);
     if (this._appInitializeMethod != null)
     {
         pfw.SetAttribute("appInitializeClass", this._appInitializeMethod.ReflectedType.FullName);
     }
 }
Exemplo n.º 7
0
 internal override void SetPreservedAttributes(PreservationFileWriter pfw)
 {
     base.SetPreservedAttributes(pfw);
     if (this.HasResultAssembly)
     {
         string fullName;
         if (this.IsGacAssembly)
         {
             fullName = this.ResultAssembly.FullName;
         }
         else
         {
             fullName = this.ShortAssemblyName;
         }
         pfw.SetAttribute("assembly", fullName);
     }
 }
    internal override void CacheBuildResult(string cacheKey, BuildResult result,
        long hashCode, DateTime utcStart) {

        // If it should not be cached to disk, leave it alone
        if (!result.CacheToDisk)
            return;

        // VSWhidbey 564168 don't save to disk if already shutting down, otherwise we might
        // be persisting assembly that was compiled with obsolete references.
        // Since we are shutting down and not creating any cache, delete the compiled result 
        // as it will not be used in future.
        if (HostingEnvironment.ShutdownInitiated) {
            BuildResultCompiledAssemblyBase compiledResult = result as BuildResultCompiledAssemblyBase;
            if (compiledResult != null)
                MarkAssemblyAndRelatedFilesForDeletion(compiledResult.ResultAssembly.GetName().Name);
            return;
        }

        string preservationFile = GetPreservedDataFileName(cacheKey);
        PreservationFileWriter pfw = new PreservationFileWriter(PrecompilationMode);

        pfw.SaveBuildResultToFile(preservationFile, result, hashCode);
    }
 internal override void SetPreservedAttributes(PreservationFileWriter pfw)
 {
     base.SetPreservedAttributes(pfw);
     if (this.HasResultAssembly)
     {
         string fullName;
         if (this.IsGacAssembly)
         {
             fullName = this.ResultAssembly.FullName;
         }
         else
         {
             fullName = this.ShortAssemblyName;
         }
         pfw.SetAttribute("assembly", fullName);
     }
 }
Exemplo n.º 10
0
 internal override void SetPreservedAttributes(PreservationFileWriter pfw) {
     base.SetPreservedAttributes(pfw);
     pfw.SetAttribute("type", FullResultTypeName);
 }
Exemplo n.º 11
0
    internal override void SetPreservedAttributes(PreservationFileWriter pfw) {
        base.SetPreservedAttributes(pfw);

        pfw.SetAttribute("resHash", ResourcesDependenciesHash);
    }
Exemplo n.º 12
0
    internal override void SetPreservedAttributes(PreservationFileWriter pfw) {
        base.SetPreservedAttributes(pfw);

        if (HasResultAssembly) {
            string assemblyName;
            if (IsGacAssembly) {
                // If it's in the GAC, store the full name (VSWhidbey 384416)
                assemblyName = ResultAssembly.FullName;
            }
            else {
                // Otherwise, store the short name, to avoid uselessly growing the preservation file
                assemblyName = ShortAssemblyName;
            }
            pfw.SetAttribute("assembly", assemblyName);
        }
    }
Exemplo n.º 13
0
    internal override void SetPreservedAttributes(PreservationFileWriter pfw) {
        base.SetPreservedAttributes(pfw);

        // Preserve the custom string
        pfw.SetAttribute("customString", _customString);
    }
Exemplo n.º 14
0
 internal virtual void SetPreservedAttributes(PreservationFileWriter pfw) {
     if (Flags != 0) {
         pfw.SetAttribute("flags", Flags.ToString("x", CultureInfo.InvariantCulture));
     }
 }
Exemplo n.º 15
0
 internal override void SetPreservedAttributes(PreservationFileWriter pfw)
 {
     base.SetPreservedAttributes(pfw);
     pfw.SetAttribute("customString", this._customString);
 }
 internal override void SetPreservedAttributes(PreservationFileWriter pfw)
 {
     base.SetPreservedAttributes(pfw);
     pfw.SetAttribute("type", this.FullResultTypeName);
 }
 internal override void SetPreservedAttributes(PreservationFileWriter pfw)
 {
     base.SetPreservedAttributes(pfw);
     pfw.SetAttribute("resHash", this.ResourcesDependenciesHash);
 }
Exemplo n.º 18
0
    internal override void SetPreservedAttributes(PreservationFileWriter pfw) {

        base.SetPreservedAttributes(pfw);

        // If there is an AppInitialize method, save the class name that it's in
        if (_appInitializeMethod != null) {
            pfw.SetAttribute("appInitializeClass", _appInitializeMethod.ReflectedType.FullName);
        }
    }