// 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(System.Diagnostics.DebuggableAttribute.DebuggingModes modes) { }