public Emitter(EmitterOptions options)
{
_options = options;
//// TODO: setup separate app domain with appropriate cache path, shadow copying etc.
//var domainName = "plan" + DateTime.Now.Ticks.ToString();
//var domain = AppDomain.CreateDomain(domainName);
_assemblyName = new AssemblyName(_options.AssemblyName);
_assembly =
AppDomain.CurrentDomain.DefineDynamicAssembly
(
_assemblyName,
_options.DebugOn ? AssemblyBuilderAccess.RunAndSave : AssemblyBuilderAccess.RunAndCollect
);
if (_options.DebugOn)
_assembly.SetCustomAttribute
(
new CustomAttributeBuilder
(
typeof(DebuggableAttribute).GetConstructor
(
new System.Type[] { typeof(DebuggableAttribute.DebuggingModes) }
),
new object[]
{
DebuggableAttribute.DebuggingModes.DisableOptimizations |
DebuggableAttribute.DebuggingModes.Default
}
)
);
_module = _assembly.DefineDynamicModule(_assemblyName.Name, _assemblyName.Name + ".dll", _options.DebugOn);
if (_options.DebugOn)
_symbolWriter = _module.DefineDocument(_options.SourceFileName, Guid.Empty, Guid.Empty, Guid.Empty);
_tupleToNative = new Dictionary<TupleType, System.Type>();
}