internal override BuildResult GetBuildResult(string cacheKey, VirtualPath virtualPath, long hashCode, bool ensureIsUpToDate) { string preservedDataFileName = this.GetPreservedDataFileName(cacheKey); PreservationFileReader reader = new PreservationFileReader(this, this.PrecompilationMode); return(reader.ReadBuildResultFromFile(virtualPath, preservedDataFileName, hashCode, ensureIsUpToDate)); }
internal static Assembly GetPreservedAssembly(PreservationFileReader pfr) { Assembly assembly2; string attribute = pfr.GetAttribute("assembly"); if (attribute == null) { return(null); } try { Assembly a = Assembly.Load(attribute); if (AssemblyIsInvalid(a)) { throw new InvalidOperationException(); } CheckAssemblyIsValid(a, new Hashtable()); assembly2 = a; } catch { pfr.DiskCache.RemoveAssemblyAndRelatedFiles(attribute); throw; } return(assembly2); }
internal static Assembly GetPreservedAssembly(PreservationFileReader pfr) { Assembly assembly2; string attribute = pfr.GetAttribute("assembly"); if (attribute == null) { return null; } try { Assembly a = Assembly.Load(attribute); if (AssemblyIsInvalid(a)) { throw new InvalidOperationException(); } CheckAssemblyIsValid(a, new Hashtable()); assembly2 = a; } catch { pfr.DiskCache.RemoveAssemblyAndRelatedFiles(attribute); throw; } return assembly2; }
internal override void GetPreservedAttributes(PreservationFileReader pfr) { base.GetPreservedAttributes(pfr); Assembly preservedAssembly = BuildResultCompiledAssemblyBase.GetPreservedAssembly(pfr); string attribute = pfr.GetAttribute("type"); this.ResultType = preservedAssembly.GetType(attribute, true); }
protected void ReadPreservedFlags(PreservationFileReader pfr) { string attribute = pfr.GetAttribute("flags"); if ((attribute != null) && (attribute.Length != 0)) { this.Flags = int.Parse(attribute, NumberStyles.AllowHexSpecifier, CultureInfo.InvariantCulture); } }
internal override void GetPreservedAttributes(PreservationFileReader pfr) { base.GetPreservedAttributes(pfr); string attribute = pfr.GetAttribute("appInitializeClass"); if (attribute != null) { Type t = this.ResultAssembly.GetType(attribute); this._appInitializeMethod = this.FindAppInitializeMethod(t); } }
internal override void RemoveOutOfDateResources(PreservationFileReader pfr) { base.ReadPreservedFlags(pfr); if (!this.UsesExistingAssembly) { string attribute = pfr.GetAttribute("assembly"); if (attribute != null) { pfr.DiskCache.RemoveAssemblyAndRelatedFiles(attribute); } } }
internal override void GetPreservedAttributes(PreservationFileReader pfr) { base.GetPreservedAttributes(pfr); string attribute = pfr.GetAttribute("CCUpreservationFileName"); using (FileStream stream = File.Open(Path.Combine(HttpRuntime.CodegenDirInternal, attribute), FileMode.Open)) { BinaryFormatter formatter = new BinaryFormatter(); this._codeCompileUnit = formatter.Deserialize(stream) as System.CodeDom.CodeCompileUnit; this._codeDomProviderType = (Type) formatter.Deserialize(stream); this._compilerParameters = (System.CodeDom.Compiler.CompilerParameters) formatter.Deserialize(stream); this._linePragmasTable = formatter.Deserialize(stream) as IDictionary; } }
internal override void GetPreservedAttributes(PreservationFileReader pfr) { base.GetPreservedAttributes(pfr); string attribute = pfr.GetAttribute("CCUpreservationFileName"); using (FileStream stream = File.Open(Path.Combine(HttpRuntime.CodegenDirInternal, attribute), FileMode.Open)) { BinaryFormatter formatter = new BinaryFormatter(); this._codeCompileUnit = formatter.Deserialize(stream) as System.CodeDom.CodeCompileUnit; this._codeDomProviderType = (Type)formatter.Deserialize(stream); this._compilerParameters = (System.CodeDom.Compiler.CompilerParameters)formatter.Deserialize(stream); this._linePragmasTable = formatter.Deserialize(stream) as IDictionary; } }
internal override BuildResult GetBuildResult(string cacheKey, VirtualPath virtualPath, long hashCode, bool ensureIsUpToDate) { Debug.Trace("BuildResultCache", "Looking for '" + cacheKey + "' in the disk cache"); string preservationFile = GetPreservedDataFileName(cacheKey); PreservationFileReader pfr = new PreservationFileReader(this, PrecompilationMode); // Create the BuildResult from the preservation file BuildResult result = pfr.ReadBuildResultFromFile(virtualPath, preservationFile, hashCode, ensureIsUpToDate); if (result != null) { Debug.Trace("BuildResultCache", "'" + cacheKey + "' was found in the disk cache"); } else { Debug.Trace("BuildResultCache", "'" + cacheKey + "' was not found in the disk cache"); } return(result); }
internal override void GetPreservedAttributes(PreservationFileReader pfr) { base.GetPreservedAttributes(pfr); this._customString = pfr.GetAttribute("customString"); }
internal override void GetPreservedAttributes(PreservationFileReader pfr) { base.GetPreservedAttributes(pfr); ResourcesDependenciesHash = pfr.GetAttribute("resHash"); }
internal override void GetPreservedAttributes(PreservationFileReader pfr) { base.GetPreservedAttributes(pfr); // Get the assembly and type Assembly a = GetPreservedAssembly(pfr); Debug.Assert(a != null); string typeName = pfr.GetAttribute("type"); ResultType = a.GetType(typeName, true /*throwOnError*/); }
internal override void GetPreservedAttributes(PreservationFileReader pfr) { base.GetPreservedAttributes(pfr); ResultAssembly = GetPreservedAssembly(pfr); }
internal override void GetPreservedAttributes(PreservationFileReader pfr) { base.GetPreservedAttributes(pfr); // Does the assembly have an AppInitialize method? string appInitializeClass = pfr.GetAttribute("appInitializeClass"); if (appInitializeClass != null) { // Get the Type that contains the method Type appInitializeType = ResultAssembly.GetType(appInitializeClass); Debug.Assert(appInitializeType != null); // Find the method _appInitializeMethod = FindAppInitializeMethod(appInitializeType); Debug.Assert(_appInitializeMethod != null); } }
internal static Assembly GetPreservedAssembly(PreservationFileReader pfr) { string assemblyName = pfr.GetAttribute("assembly"); if (assemblyName == null) return null; // Try to load the assembly try { Assembly a = Assembly.Load(assemblyName); // VSWhidbey 564168 // Do not load assemblies or assemblies with references that // do not exist or are marked for deletion // It is possible that Assembly.Load succeeds, even though the // underlying DLL was renamed (to .delete). In that case, we should // not return the assembly, as we would be unable to compile with // a reference to it. if (AssemblyIsInvalid(a)) { // Throw some exception, since the caller doesn't expect null throw new InvalidOperationException(); } // Check references of the assembly, and make sure they exists, // otherwise throw an exception. CheckAssemblyIsValid(a, new Hashtable()); return a; } catch { Debug.Trace("BuildResult", "GetPreservedAssembly: couldn't load assembly '" + assemblyName + "'; deleting associated files."); // Remove the assembly and all the associated files pfr.DiskCache.RemoveAssemblyAndRelatedFiles(assemblyName); throw; } }
/* * Tell the BuildResult that its dependencies are not up to date, in order * to give it a chance to do some cleanup. */ internal override void RemoveOutOfDateResources(PreservationFileReader pfr) { // If the preservation file is pointing to an assembly that was not built // for this result, do not attempt to clean it up (see VSWhidbey 74094) ReadPreservedFlags(pfr); if (UsesExistingAssembly) return; // Remove the assembly and all the associated files string assemblyName = pfr.GetAttribute("assembly"); if (assemblyName != null) { pfr.DiskCache.RemoveAssemblyAndRelatedFiles(assemblyName); } }
internal override void GetPreservedAttributes(PreservationFileReader pfr) { base.GetPreservedAttributes(pfr); this.ResultAssembly = BuildResultCompiledAssemblyBase.GetPreservedAssembly(pfr); }
internal override void GetPreservedAttributes(PreservationFileReader pfr) { base.GetPreservedAttributes(pfr); // Retrieve the custom string _customString = pfr.GetAttribute("customString"); Debug.Assert(_customString != null); }
internal override void RemoveOutOfDateResources(PreservationFileReader pfr) { string attribute = pfr.GetAttribute("CCUpreservationFileName"); File.Delete(Path.Combine(HttpRuntime.CodegenDirInternal, attribute)); }
internal override BuildResult GetBuildResult(string cacheKey, VirtualPath virtualPath, long hashCode, bool ensureIsUpToDate) { Debug.Trace("BuildResultCache", "Looking for '" + cacheKey + "' in the disk cache"); string preservationFile = GetPreservedDataFileName(cacheKey); PreservationFileReader pfr = new PreservationFileReader(this, PrecompilationMode); // Create the BuildResult from the preservation file BuildResult result = pfr.ReadBuildResultFromFile(virtualPath, preservationFile, hashCode, ensureIsUpToDate); if (result != null) Debug.Trace("BuildResultCache", "'" + cacheKey + "' was found in the disk cache"); else Debug.Trace("BuildResultCache", "'" + cacheKey + "' was not found in the disk cache"); return result; }
internal override void GetPreservedAttributes(PreservationFileReader pfr) { base.GetPreservedAttributes(pfr); String _ccuPreservationFileName = pfr.GetAttribute(fileNameAttribute); _ccuPreservationFileName = Path.Combine(HttpRuntime.CodegenDirInternal, _ccuPreservationFileName); Debug.Assert(FileUtil.FileExists(_ccuPreservationFileName), _ccuPreservationFileName); using (FileStream stream = File.Open(_ccuPreservationFileName, FileMode.Open)) { BinaryFormatter formatter = new BinaryFormatter(); _codeCompileUnit = formatter.Deserialize(stream) as CodeCompileUnit; _codeDomProviderType = (Type)formatter.Deserialize(stream); _compilerParameters = (CompilerParameters)formatter.Deserialize(stream); _linePragmasTable = formatter.Deserialize(stream) as IDictionary; } }
internal override BuildResult GetBuildResult(string cacheKey, VirtualPath virtualPath, long hashCode, bool ensureIsUpToDate) { string preservedDataFileName = this.GetPreservedDataFileName(cacheKey); PreservationFileReader reader = new PreservationFileReader(this, this.PrecompilationMode); return reader.ReadBuildResultFromFile(virtualPath, preservedDataFileName, hashCode, ensureIsUpToDate); }
internal override void RemoveOutOfDateResources(PreservationFileReader pfr) { // Remove the out-of-date .ccu file String ccuPreservationFileName = pfr.GetAttribute(fileNameAttribute); ccuPreservationFileName = Path.Combine(HttpRuntime.CodegenDirInternal, ccuPreservationFileName); File.Delete(ccuPreservationFileName); }
internal virtual void RemoveOutOfDateResources(PreservationFileReader pfw) { }
protected void ReadPreservedFlags(PreservationFileReader pfr) { string s = pfr.GetAttribute("flags"); if ((s != null) && (s.Length != 0)) { Flags = Int32.Parse(s, NumberStyles.AllowHexSpecifier, CultureInfo.InvariantCulture); } }
internal virtual void GetPreservedAttributes(PreservationFileReader pfr) { ReadPreservedFlags(pfr); }
/* * Tell the BuildResult that its dependencies are not up to date, in order * to give it a chance to do some cleanup. */ internal virtual void RemoveOutOfDateResources(PreservationFileReader pfw) {}
internal override void GetPreservedAttributes(PreservationFileReader pfr) { base.GetPreservedAttributes(pfr); this.ResourcesDependenciesHash = pfr.GetAttribute("resHash"); }
internal virtual void GetPreservedAttributes(PreservationFileReader pfr) { this.ReadPreservedFlags(pfr); }