// SxS note: AssemblyBuilder.DefineDynamicModule() below may be using name which is not SxS safe. // This file is written only for internal tracing/debugging purposes. In retail builds persistAsm // will be always false and the file should never be written. As a result it's fine just to supress // the the SxS warning. public XmlILModule(bool useLRE, bool emitSymbols) { AssemblyName asmName; AssemblyBuilder asmBldr; ModuleBuilder modBldr; Debug.Assert(!(useLRE && emitSymbols)); _useLRE = useLRE; _emitSymbols = emitSymbols; _persistAsm = false; // Index all methods added to this module by unique name _methods = new Hashtable(); if (!useLRE) { // 1. If assembly needs to support debugging, then it must be saved and re-loaded (rule of CLR) // 2. Get path of temp directory, where assembly will be saved // 3. Never allow assembly to Assert permissions asmName = CreateAssemblyName(); #if DEBUG if (XmlILTrace.IsEnabled) { this.modFile = "System.Xml.Xsl.CompiledQuery"; this.persistAsm = true; } #endif asmBldr = AssemblyBuilder.DefineDynamicAssembly( asmName, AssemblyBuilderAccess.Run); // Add custom attribute to assembly marking it as security transparent so that Assert will not be allowed // and link demands will be converted to full demands. asmBldr.SetCustomAttribute(new CustomAttributeBuilder(XmlILConstructors.Transparent, new object[] { })); if (emitSymbols) { // Create mapping from source document to symbol writer _urlToSymWriter = new Hashtable(); // Add DebuggableAttribute to assembly so that debugging is a better experience DebuggingModes debuggingModes = DebuggingModes.Default | DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggingModes.DisableOptimizations; asmBldr.SetCustomAttribute(new CustomAttributeBuilder(XmlILConstructors.Debuggable, new object[] { debuggingModes })); } // Create ModuleBuilder if (_persistAsm) { modBldr = asmBldr.DefineDynamicModule("System.Xml.Xsl.CompiledQuery"); } else { modBldr = asmBldr.DefineDynamicModule("System.Xml.Xsl.CompiledQuery"); //, this.modFile + ".dll", emitSymbols); //BinCompat TODO } _typeBldr = modBldr.DefineType("System.Xml.Xsl.CompiledQuery.Query", TypeAttributes.Public); } }
// Public Instance Constructors public DebuggableAttribute(bool isJITTrackingEnabled, bool isJITOptimizerDisabled) { JITTrackingEnabledFlag = isJITTrackingEnabled; JITOptimizerDisabledFlag = isJITOptimizerDisabled; if (isJITTrackingEnabled) debuggingModes |= DebuggingModes.Default; if (isJITOptimizerDisabled) debuggingModes |= DebuggingModes.DisableOptimizations; }
public DebuggableAttribute(bool isJITTrackingEnabled, bool isJITOptimizerDisabled) { this.m_debuggingModes = DebuggingModes.None; if (isJITTrackingEnabled) { this.m_debuggingModes |= DebuggingModes.Default; } if (isJITOptimizerDisabled) { this.m_debuggingModes |= DebuggingModes.DisableOptimizations; } }
public DebuggableAttribute(bool isJITTrackingEnabled, bool isJITOptimizerDisabled) { this.m_debuggingModes = DebuggingModes.None; if (isJITTrackingEnabled) { this.m_debuggingModes |= DebuggingModes.Default; } if (isJITOptimizerDisabled) { this.m_debuggingModes |= DebuggingModes.DisableOptimizations; } }
public DebuggableAttribute(bool enableJITTracking, bool disableJITOptimizer) { debuggingFlags = DebuggingModes.None; if (enableJITTracking) { debuggingFlags |= DebuggingModes.Default; } if (disableJITOptimizer) { debuggingFlags |= DebuggingModes.DisableOptimizations; } }
public DebuggableAttribute(bool enableJITTracking, bool disableJITOptimizer) { debuggingFlags = DebuggingModes.None; if(enableJITTracking) { debuggingFlags |= DebuggingModes.Default; } if(disableJITOptimizer) { debuggingFlags |= DebuggingModes.DisableOptimizations; } }
// Public Instance Constructors public DebuggableAttribute(bool isJITTrackingEnabled, bool isJITOptimizerDisabled) { JITTrackingEnabledFlag = isJITTrackingEnabled; JITOptimizerDisabledFlag = isJITOptimizerDisabled; if (isJITTrackingEnabled) { debuggingModes |= DebuggingModes.Default; } if (isJITOptimizerDisabled) { debuggingModes |= DebuggingModes.DisableOptimizations; } }
// SxS note: AssemblyBuilder.DefineDynamicModule() below may be using name which is not SxS safe. // This file is written only for internal tracing/debugging purposes. In retail builds persistAsm // will be always false and the file should never be written. As a result it's fine just to suppress // the SxS warning. public XmlILModule(bool useLRE, bool emitSymbols) { AssemblyName asmName; AssemblyBuilder asmBldr; ModuleBuilder modBldr; Debug.Assert(!(useLRE && emitSymbols)); _useLRE = useLRE; _emitSymbols = emitSymbols; // Index all methods added to this module by unique name _methods = new Hashtable(); if (!useLRE) { // 1. If assembly needs to support debugging, then it must be saved and re-loaded (rule of CLR) // 2. Get path of temp directory, where assembly will be saved // 3. Never allow assembly to Assert permissions asmName = CreateAssemblyName(); asmBldr = AssemblyBuilder.DefineDynamicAssembly( asmName, AssemblyBuilderAccess.Run); // Add custom attribute to assembly marking it as security transparent so that Assert will not be allowed // and link demands will be converted to full demands. asmBldr.SetCustomAttribute(new CustomAttributeBuilder(XmlILConstructors.Transparent, Array.Empty <object>())); if (emitSymbols) { // Add DebuggableAttribute to assembly so that debugging is a better experience DebuggingModes debuggingModes = DebuggingModes.Default | DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggingModes.DisableOptimizations; asmBldr.SetCustomAttribute(new CustomAttributeBuilder(XmlILConstructors.Debuggable, new object[] { debuggingModes })); } // Create ModuleBuilder modBldr = asmBldr.DefineDynamicModule("System.Xml.Xsl.CompiledQuery"); _typeBldr = modBldr.DefineType("System.Xml.Xsl.CompiledQuery.Query", TypeAttributes.Public); } }
public DebuggableAttribute(DebuggingModes modes) { }
public DebuggableAttribute(DebuggingModes modes) { debuggingModes = modes; JITTrackingEnabledFlag = (debuggingModes & DebuggingModes.Default) != 0; JITOptimizerDisabledFlag = (debuggingModes & DebuggingModes.DisableOptimizations) != 0; }
// Constructors. public DebuggableAttribute(DebuggingModes modes) { debuggingFlags = modes; }
/// <summary> /// Default ctor /// </summary> public DebuggableAttribute(DebuggingModes mode) { this.mode = mode; }
public DebuggableAttribute(DebuggingModes modes) { throw new NotImplementedException(); }
public DebuggableAttribute(DebuggingModes modes) { }
public DebuggableAttribute(DebuggingModes modes) { debuggingModes = modes; JITTrackingEnabledFlag = (debuggingModes & DebuggingModes.Default) != 0; JITOptimizerDisabledFlag = (debuggingModes & DebuggingModes.DisableOptimizations) != 0; }
/// <summary> /// Analyzes an assembly to read its attributes. /// </summary> /// <param name="assemblyFile">Path to the assembly.</param> /// <returns>Attributes from the assembly.</returns> public static AssemblyAttributes ReadAssembly(string assemblyFile) { AssemblyAttributes attribs = new AssemblyAttributes(); attribs.FileName = new FileInfo(assemblyFile).Name; Assembly reflectedAssembly; try { reflectedAssembly = Assembly.ReflectionOnlyLoadFrom(assemblyFile); } catch (BadImageFormatException) { // Not a valid asssembly attribs.IsManagedAssembly = false; return(attribs); } catch (FileLoadException) { // Not a .Net managed assembly attribs.IsManagedAssembly = false; return(attribs); } attribs.IsManagedAssembly = true; // If the 'DebuggableAttribute' is not found then it is definitely an OPTIMIZED build attribs.BuildType = "Release"; attribs.DebugOutput = "Full"; attribs.Version = reflectedAssembly.GetName().Version; IList <CustomAttributeData> list = CustomAttributeData.GetCustomAttributes(reflectedAssembly); foreach (CustomAttributeData data in list) { if (data.AttributeType == typeof(DebuggableAttribute)) { attribs.HasDebuggableAttribute = true; // Just because the 'DebuggableAttribute' is found doesn't necessarily mean // it's a DEBUG build; we have to check the JIT Optimization flag // i.e. it could have the "generate PDB" checked but have JIT Optimization enabled DebuggingModes modes = (DebuggingModes)data.ConstructorArguments[0].Value; attribs.IsJitOptimized = (modes & DebuggingModes.DisableOptimizations) != DebuggingModes.DisableOptimizations; attribs.BuildType = attribs.IsJitOptimized ? "Release" : "Debug"; // check for Debug Output "full" or "pdb-only" attribs.DebugOutput = (modes & DebuggingModes.Default) != DebuggingModes.None ? "Full" : "pdb-only"; continue; } else if (data.AttributeType == typeof(AssemblyFileVersionAttribute)) { Version ver; if (Version.TryParse((string)data.ConstructorArguments[0].Value, out ver)) { attribs.FileVersion = ver; } } else if (data.AttributeType == typeof(AssemblyCompanyAttribute)) { attribs.Company = (string)data.ConstructorArguments[0].Value; } else if (data.AttributeType == typeof(AssemblyCopyrightAttribute)) { attribs.Copyright = (string)data.ConstructorArguments[0].Value; } } ////object[] customAttribs = reflectedAssembly.GetCustomAttributes(typeof(DebuggableAttribute), false); ////// If the 'DebuggableAttribute' is not found then it is definitely an OPTIMIZED build ////if (customAttribs.Length > 0) ////{ //// // Just because the 'DebuggableAttribute' is found doesn't necessarily mean //// // it's a DEBUG build; we have to check the JIT Optimization flag //// // i.e. it could have the "generate PDB" checked but have JIT Optimization enabled //// DebuggableAttribute debuggableAttribute = customAttribs[0] as DebuggableAttribute; //// if (debuggableAttribute != null) //// { //// attribs.HasDebuggableAttribute = true; //// attribs.IsJitOptimized = !debuggableAttribute.IsJITOptimizerDisabled; //// attribs.BuildType = attribs.IsJitOptimized ? "Release" : "Debug"; //// // check for Debug Output "full" or "pdb-only" //// attribs.DebugOutput = (debuggableAttribute.DebuggingFlags & DebuggableAttribute.DebuggingModes.Default) != DebuggableAttribute.DebuggingModes.None ? "Full" : "pdb-only"; //// } ////} ////else ////{ //// attribs.BuildType = "Release"; //// attribs.DebugOutput = "Full"; ////} ////customAttribs = reflectedAssembly.GetCustomAttributes(typeof(AssemblyFileVersionAttribute), false); ////if (customAttribs.Length > 0) ////{ //// attribs.FileVersion = Version.Parse((customAttribs[0] as AssemblyFileVersionAttribute).Version); ////} ////attribs.Version = reflectedAssembly.GetName().Version; ////customAttribs = reflectedAssembly.GetCustomAttributes(typeof(AssemblyCompanyAttribute), false); ////if (customAttribs.Length > 0) ////{ //// attribs.Company = (customAttribs[0] as AssemblyCompanyAttribute).Company; ////} ////customAttribs = reflectedAssembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); ////if (customAttribs.Length > 0) ////{ //// attribs.Copyright = (customAttribs[0] as AssemblyCopyrightAttribute).Copyright; ////} return(attribs); }
public extern DebuggableAttribute(DebuggingModes modes);
public DebuggableAttribute(DebuggingModes modes) { this.m_debuggingModes = modes; }
/// <summary> /// Default ctor /// </summary> public DebuggableAttribute(DebuggingModes mode) { this.mode = mode; }
public DebuggableAttribute(DebuggingModes modes) => this.m_debuggingModes = modes;
public DebuggableAttribute(DebuggingModes modes) { m_debuggingModes = modes; }
// Constructors. public DebuggableAttribute(DebuggingModes modes) { debuggingFlags = modes; }