public static CorDebugClass ClassFromRuntimeValue (RuntimeValue rtv, CorDebugAppDomain appDomain) { RuntimeValue_Reflection rtvf = rtv as RuntimeValue_Reflection; CorDebugClass cls = null; object objBuiltInKey = null; Debug.Assert (!rtv.IsNull); if (rtvf != null) { objBuiltInKey = rtvf.ReflectionType; } else if (rtv.DataType == RuntimeDataType.DATATYPE_TRANSPARENT_PROXY) { objBuiltInKey = RuntimeDataType.DATATYPE_TRANSPARENT_PROXY; } else { cls = TinyCLR_TypeSystem.CorDebugClassFromTypeIndex (rtv.Type, appDomain); } if (objBuiltInKey != null) { CorDebugProcess.BuiltinType builtInType = appDomain.Process.ResolveBuiltInType (objBuiltInKey); cls = builtInType.GetClass (appDomain); if (cls == null) { cls = new CorDebugClass (builtInType.GetAssembly (appDomain), builtInType.TokenCLR); } } return cls; }
public CorDebugEval (CorDebugThread thread) { m_appDomain = thread.Chain.ActiveFrame.AppDomain; m_threadReal = thread; m_resultType = EvalResult.NotFinished; ResetScratchPadLocation (); }
int Microsoft.VisualStudio.Debugger.Interop.IDebugPortEx2.GetProgram(IDebugProgramNode2 pProgramNode, out IDebugProgram2 ppProgram) { CorDebugAppDomain appDomain = GetAppDomain(pProgramNode); ppProgram = appDomain; return(Utility.COM_HResults.S_OK); }
public static CorDebugValue[] CreateValues (RuntimeValue[] rtv, CorDebugAppDomain appDomain) { CorDebugValue[] values = new CorDebugValue[rtv.Length]; for (int i = 0; i < rtv.Length; i++) { values [i] = CorDebugValue.CreateValue (rtv [i], appDomain); } return values; }
public CorDebugAssembly CreateAssemblyInstance(CorDebugAppDomain appDomain) { CorDebugAssembly assm = (CorDebugAssembly)MemberwiseClone(); assm.m_appDomain = appDomain; assm.m_primaryAssembly = this; return(assm); }
//Object or CLASS, or VALUETYPE public CorDebugValueObject(RuntimeValue rtv, CorDebugAppDomain appDomain) : base(rtv, appDomain) { if (!rtv.IsNull) { m_class = CorDebugValue.ClassFromRuntimeValue(rtv, appDomain); m_fIsEnum = m_class.IsEnum; m_fIsBoxed = rtv.IsBoxed; } }
public static CorDebugValue[] CreateValues(RuntimeValue[] rtv, CorDebugAppDomain appDomain) { CorDebugValue[] values = new CorDebugValue[rtv.Length]; for (int i = 0; i < rtv.Length; i++) { values [i] = CorDebugValue.CreateValue(rtv [i], appDomain); } return(values); }
protected CorDebugBreakpointBase(CorDebugProcess process) { m_breakpointDef = new BreakpointDef(); m_breakpointDef.m_id = s_idNext++; m_breakpointDef.m_pid = BreakpointDef.c_PID_ANY; m_appDomain = null; m_process = process; Debug.Assert(s_idNext != s_idNull); }
protected CorDebugBreakpointBase( CorDebugProcess process ) { m_breakpointDef = new BreakpointDef(); m_breakpointDef.m_id = s_idNext++; m_breakpointDef.m_pid = BreakpointDef.c_PID_ANY; m_appDomain = null; m_process = process; Debug.Assert(s_idNext != s_idNull); }
public static CorDebugValue CreateValue(RuntimeValue rtv, CorDebugAppDomain appDomain) { CorDebugValue val = null; bool fIsReference; if (rtv.IsBoxed) { val = new CorDebugValueBoxedObject (rtv, appDomain); fIsReference = true; } else if (rtv.IsPrimitive) { CorDebugClass c = ClassFromRuntimeValue (rtv, appDomain); if (c.IsEnum) { val = new CorDebugValueObject (rtv, appDomain); fIsReference = false; } else { val = new CorDebugValuePrimitive (rtv, appDomain); fIsReference = false; } } else if (rtv.IsArray) { val = new CorDebugValueArray (rtv, appDomain); fIsReference = true; } else if (rtv.CorElementType == CorElementType.ELEMENT_TYPE_STRING) { val = new CorDebugValueString (rtv, appDomain); fIsReference = true; } else { val = new CorDebugValueObject (rtv, appDomain); fIsReference = !rtv.IsValueType; } if (fIsReference) { val = new CorDebugValueReference(val, val.m_rtv, val.m_appDomain); } if (rtv.IsReference) //CorElementType.ELEMENT_TYPE_BYREF { val = new CorDebugValueReferenceByRef(val, val.m_rtv, val.m_appDomain); } return val; }
private void SendProgramEvent(IDebugProgramNode2 programNode, enum_EVENTATTRIBUTES attributes, Guid iidEvent) { CorDebugProcess process = GetProcess(programNode); CorDebugAppDomain appDomain = GetAppDomain(programNode); IDebugEvent2 evt = new DebugEvent((uint)attributes); foreach (IDebugPortEvents2 dpe in m_cpDebugPortEvents2.Sinks) { dpe.Event(this.DebugPortSupplier.CoreServer, this, (IDebugProcess2)process, (IDebugProgram2)appDomain, evt, ref iidEvent); } }
public CorDebugAssembly CreateAssemblyInstance(CorDebugAppDomain appDomain) { //Ensure the metadata import is created. IMetaDataImport iMetaDataImport = this.MetaDataImport; CorDebugAssembly assm = (CorDebugAssembly)MemberwiseClone(); assm.m_appDomain = appDomain; assm.m_primaryAssembly = this; return(assm); }
public static CorDebugValue CreateValue(RuntimeValue rtv, CorDebugAppDomain appDomain) { CorDebugValue val = null; bool fIsReference; if (rtv.IsBoxed) { val = new CorDebugValueBoxedObject(rtv, appDomain); fIsReference = true; } else if (rtv.IsPrimitive) { CorDebugClass c = ClassFromRuntimeValue(rtv, appDomain); if (c.IsEnum) { val = new CorDebugValueObject(rtv, appDomain); fIsReference = false; } else { val = new CorDebugValuePrimitive(rtv, appDomain); fIsReference = false; } } else if (rtv.IsArray) { val = new CorDebugValueArray(rtv, appDomain); fIsReference = true; } else if (rtv.CorElementType == CorElementType.ELEMENT_TYPE_STRING) { val = new CorDebugValueString(rtv, appDomain); fIsReference = true; } else { val = new CorDebugValueObject(rtv, appDomain); fIsReference = !rtv.IsValueType; } if (fIsReference) { val = new CorDebugValueReference(val, val.m_rtv, val.m_appDomain); } if (rtv.IsReference) //CorElementType.ELEMENT_TYPE_BYREF { val = new CorDebugValueReferenceByRef(val, val.m_rtv, val.m_appDomain); } return(val); }
public static CorDebugClass CorDebugClassFromTypeIndex(uint typeIndex, CorDebugAppDomain appDomain) { CorDebugClass cls = null; CorDebugAssembly assembly = appDomain.AssemblyFromIdx(TinyCLR_TypeSystem.IdxAssemblyFromIndex(typeIndex)); if (assembly != null) { uint typedef = TinyCLR_TypeSystem.CLR_TkFromType(TinyCLR_TypeSystem.CLR_TABLESENUM.TBL_TypeDef, TinyCLR_TypeSystem.IdxFromIndex(typeIndex)); cls = assembly.GetClassFromTokenTinyCLR(typedef); } return(cls); }
private CorDebugAppDomain GetAppDomain(IDebugProgramNode2 programNode) { uint appDomainId; CorDebugProcess process = GetProcess(programNode); IDebugCOMPlusProgramNode2 node = (IDebugCOMPlusProgramNode2)programNode; node.GetAppDomainId(out appDomainId); CorDebugAppDomain appDomain = process.GetAppDomainFromId(appDomainId); return(appDomain); }
public override void Dispatch(ICorDebugManagedCallback callback) { CorDebugAppDomain appDomain = m_class.Assembly.AppDomain; switch (m_eventType) { case EventType.LoadClass: callback.LoadClass(appDomain, m_class); break; case EventType.UnloadClass: callback.UnloadClass(appDomain, m_class); break; } }
public static CorDebugAssembly AssemblyFromIndex(CorDebugAppDomain appDomain, uint index) { return(appDomain.AssemblyFromIdx(TinyCLR_TypeSystem.IdxAssemblyFromIndex(index))); }
protected CorDebugBreakpointBase(CorDebugAppDomain appDomain) : this(appDomain.Process) { m_appDomain = appDomain; }
public CorDebugValue GetValue(int index, CorDebugAppDomain appDomain) { WeakReference wr = m_scratchPad[index]; if (wr == null) { wr = new WeakReference(null); m_scratchPad[index] = wr; } CorDebugValue val = (CorDebugValue) wr.Target; if (val == null) { val = CorDebugValue.CreateValue(m_process.Engine.GetScratchPadValue(index), appDomain); wr.Target = val; } return val; }
public CorDebugValueReferenceByRef (CorDebugValue val, RuntimeValue rtv, CorDebugAppDomain appDomain) : base (val, rtv, appDomain) { }
//Object or CLASS, or VALUETYPE public CorDebugValueObject (RuntimeValue rtv, CorDebugAppDomain appDomain) : base (rtv, appDomain) { if (!rtv.IsNull) { m_class = CorDebugValue.ClassFromRuntimeValue (rtv, appDomain); m_fIsEnum = m_class.IsEnum; m_fIsBoxed = rtv.IsBoxed; } }
internal ArrayList GetBreakpoints( Type t, CorDebugAppDomain appDomain ) { ArrayList al = new ArrayList( m_breakpoints.Count ); foreach(CorDebugBreakpointBase breakpoint in m_breakpoints) { if(t.IsAssignableFrom( breakpoint.GetType() )) { if(appDomain == null || appDomain == breakpoint.AppDomain) { al.Add( breakpoint ); } } } return al; }
public CorDebugValueBoxedObject (RuntimeValue rtv, CorDebugAppDomain appDomain) : base (rtv, appDomain) { m_value = new CorDebugValueObject (rtv, appDomain); }
public CorDebugValueReferenceByRef(CorDebugValue val, RuntimeValue rtv, CorDebugAppDomain appDomain) : base(val, rtv, appDomain) { }
public CorDebugValueArray(RuntimeValue rtv, CorDebugAppDomain appDomain) : base(rtv, appDomain) { }
public CorDebugValueBoxedObject(RuntimeValue rtv, CorDebugAppDomain appDomain) : base(rtv, appDomain) { m_value = new CorDebugValueObject(rtv, appDomain); }
public CorDebugValueReference(CorDebugValue val, RuntimeValue rtv, CorDebugAppDomain appDomain) : base(rtv, appDomain) { m_value = val; }
public CorDebugValuePrimitive(RuntimeValue rtv, CorDebugAppDomain appDomain) : base(rtv, appDomain) { }
private void RemoveAppDomain(CorDebugAppDomain appDomain) { EnqueueEvent(new ManagedCallbacks.ManagedCallbackAppDomain(appDomain, ManagedCallbacks.ManagedCallbackAppDomain.EventType.ExitAppDomain)); m_appDomains.Remove(appDomain); }
public CorDebugValue(RuntimeValue rtv, CorDebugAppDomain appDomain) { m_rtv = rtv; m_appDomain = appDomain; }
public CorDebugClass GetClass( CorDebugAppDomain appDomain ) { CorDebugAssembly assembly = GetAssembly( appDomain ); return assembly.GetClassFromTokenCLR( this.m_tkCLR ); }
public CorDebugAssembly(CorDebugProcess process, string name, Pdbx.PdbxFile pdbxFile, uint idx) { m_process = process; m_appDomain = null; m_name = name; m_pdbxFile = pdbxFile; m_pdbxAssembly = (pdbxFile != null) ? pdbxFile.Assembly : null; m_htTokenCLRToPdbx = new Hashtable(); m_htTokenTinyCLRToPdbx = new Hashtable(); m_idx = idx; m_primaryAssembly = null; m_isFrameworkAssembly = false; if (m_pdbxAssembly != null) { if (!string.IsNullOrEmpty(pdbxFile.PdbxPath)) { string pth = pdbxFile.PdbxPath.ToLower(); if (pth.Contains(@"\buildoutput\")) { #region V4_1_FRAMEWORK_ASSEMBLIES List <string> frameworkAssemblies = new List <string> { "mfdpwsclient", "mfdpwsdevice", "mfdpwsextensions", "mfwsstack", "microsoft.spot.graphics", "microsoft.spot.hardware", "microsoft.spot.hardware.serialport", "microsoft.spot.hardware.usb", "microsoft.spot.ink", "microsoft.spot.io", "microsoft.spot.native", "microsoft.spot.net", "microsoft.spot.net.security", "microsoft.spot.time", "microsoft.spot.tinycore", "microsoft.spot.touch", "mscorlib", "system.http", "system.io", "system.net.security", "system", "system.xml.legacy", "system.xml", }; #endregion // V4_1_FRAMEWORK_ASSEMBLIES m_isFrameworkAssembly = (frameworkAssemblies.Contains(name.ToLower())); } else { m_isFrameworkAssembly = pdbxFile.PdbxPath.ToLower().Contains(@"\microsoft .net micro framework\"); } } m_pdbxAssembly.CorDebugAssembly = this; foreach (Pdbx.Class c in m_pdbxAssembly.Classes) { AddTokenToHashtables(c.Token, c); foreach (Pdbx.Field field in c.Fields) { AddTokenToHashtables(field.Token, field); } foreach (Pdbx.Method method in c.Methods) { AddTokenToHashtables(method.Token, method); } } } }
public void SetCurrentAppDomain( CorDebugAppDomain appDomain ) { if(appDomain != m_appDomainCurrent) { if(appDomain != null && this.Engine.Capabilities.AppDomains) { this.Engine.SetCurrentAppDomain( appDomain.Id ); } } m_appDomainCurrent = appDomain; }
public CorDebugValueString(RuntimeValue rtv, CorDebugAppDomain appDomain) : base(rtv, appDomain) { }
public CorDebugValuePrimitive (RuntimeValue rtv, CorDebugAppDomain appDomain) : base (rtv, appDomain) { }
public static CorDebugAssembly AssemblyFromIndex (CorDebugAppDomain appDomain, uint index) { return appDomain.AssemblyFromIdx (TinyCLR_TypeSystem.IdxAssemblyFromIndex (index)); }
public CorDebugValueReference (CorDebugValue val, RuntimeValue rtv, CorDebugAppDomain appDomain) : base (rtv, appDomain) { m_value = val; }
public ManagedCallbackAppDomain(CorDebugAppDomain appDomain, EventType eventType) { m_appDomain = appDomain; m_eventType = eventType; }
public CorDebugValueArray (RuntimeValue rtv, CorDebugAppDomain appDomain) : base (rtv, appDomain) { }
public CorDebugValue (RuntimeValue rtv, CorDebugAppDomain appDomain) { m_rtv = rtv; m_appDomain = appDomain; }
public CorDebugValueString (RuntimeValue rtv, CorDebugAppDomain appDomain) : base (rtv, appDomain) { }
public ManagedCallbackAppDomain (CorDebugAppDomain appDomain, EventType eventType) { m_appDomain = appDomain; m_eventType = eventType; }
public CorDebugAssembly(CorDebugProcess process, string name, Pdbx.PdbxFile pdbxFile, uint idx) { m_process = process; m_appDomain = null; m_name = name; m_pdbxFile = pdbxFile; m_pdbxAssembly = (pdbxFile != null) ? pdbxFile.Assembly : null; m_htTokenCLRToPdbx = new Hashtable(); m_htTokenTinyCLRToPdbx = new Hashtable(); m_idx = idx; m_primaryAssembly = null; m_isFrameworkAssembly = false; if (m_pdbxAssembly != null) { if (!string.IsNullOrEmpty(pdbxFile.PdbxPath)) { string pth = pdbxFile.PdbxPath.ToLower(); if (pth.Contains(Path.DirectorySeparatorChar + "buildoutput" + Path.DirectorySeparatorChar)) { #region V4_1_FRAMEWORK_ASSEMBLIES List <string> frameworkAssemblies = new List <string> { "mfdpwsclient", "mfdpwsdevice", "mfdpwsextensions", "mfwsstack", "microsoft.spot.graphics", "microsoft.spot.hardware", "microsoft.spot.hardware.serialport", "microsoft.spot.hardware.usb", "microsoft.spot.ink", "microsoft.spot.io", "microsoft.spot.native", "microsoft.spot.net", "microsoft.spot.net.security", "microsoft.spot.time", "microsoft.spot.tinycore", "microsoft.spot.touch", "mscorlib", "system.http", "system.io", "system.net.security", "system", "system.xml.legacy", "system.xml", }; #endregion // V4_1_FRAMEWORK_ASSEMBLIES m_isFrameworkAssembly = (frameworkAssemblies.Contains(name.ToLower())); } else { m_isFrameworkAssembly = pdbxFile.PdbxPath.ToLower().Contains(Path.PathSeparator + ".net micro framework" + Path.PathSeparator); } } m_pdbxAssembly.CorDebugAssembly = this; foreach (Pdbx.Class c in m_pdbxAssembly.Classes) { AddTokenToHashtables(c.Token, c); foreach (Pdbx.Field field in c.Fields) { AddTokenToHashtables(field.Token, field); } foreach (Pdbx.Method method in c.Methods) { AddTokenToHashtables(method.Token, method); } } if (File.Exists(Path.ChangeExtension(m_pdbxFile.PdbxPath, ".dll"))) { MetaData = ModuleDefinition.ReadModule(Path.ChangeExtension(m_pdbxFile.PdbxPath, ".dll")); } else if (File.Exists(Path.ChangeExtension(m_pdbxFile.PdbxPath, ".exe"))) { MetaData = ModuleDefinition.ReadModule(Path.ChangeExtension(m_pdbxFile.PdbxPath, ".exe")); } if (MetaData != null && File.Exists(Path.ChangeExtension(m_pdbxFile.PdbxPath, ".exe.mdb"))) { DebugData = new Mono.Cecil.Mdb.MdbReaderProvider().GetSymbolReader(MetaData, Path.ChangeExtension(m_pdbxFile.PdbxPath, ".exe")); MetaData.ReadSymbols(DebugData); } else if (MetaData != null && File.Exists(Path.ChangeExtension(m_pdbxFile.PdbxPath, ".dll.mdb"))) { DebugData = new Mono.Cecil.Mdb.MdbReaderProvider().GetSymbolReader(MetaData, Path.ChangeExtension(m_pdbxFile.PdbxPath, ".dll")); MetaData.ReadSymbols(DebugData); } } }
private void EnqueueStartupEventsAndWait() { DebugAssert(m_pid != 0); //cpde will fail DebugAssert(m_portDefinition != null); EnqueueEvent(new ManagedCallbacks.ManagedCallbackProcess(this, ManagedCallbacks.ManagedCallbackProcess.EventType.CreateProcess)); CorDebugAppDomain appDomain = new CorDebugAppDomain(this, 1); m_appDomains.Add(appDomain); EnqueueEvent(new ManagedCallbacks.ManagedCallbackAppDomain(appDomain, ManagedCallbacks.ManagedCallbackAppDomain.EventType.CreateAppDomain)); if (m_fLaunched) { //the sdm tries to resumeProcess through the DE, but cpde doesn't propagate that message to our //Debug Port. As a result, we have to create a dummy thread, just so that cpde can resume it. //We wait for initialization to be complete, by getting signaled by the dummy thread. VsPackage.MessageCentre.InternalErrorMsg(false, DiagnosticStrings.WaitingForWakeup); WaitDummyThread(); } //Dispatch the CreateProcess/CreateAppDomain events, so that VS will hopefully shut down nicely from now on FlushEvents(); DebugAssert(m_cStopped == 0); DebugAssert(!AnyQueuedEvents); }
public ManagedCallbackDebugMessage (CorDebugThread thread, CorDebugAppDomain appDomain, string switchName, string message, LoggingLevelEnum level) : base (thread) { m_switchName = switchName; m_message = message; m_level = level; m_appDomain = appDomain; }
public static CorDebugFunction CorDebugFunctionFromMethodIndex(uint methodIndex, CorDebugAppDomain appDomain) { CorDebugFunction function = null; CorDebugAssembly assembly = appDomain.AssemblyFromIdx(TinyCLR_TypeSystem.IdxAssemblyFromIndex(methodIndex)); if (assembly != null) { uint tk = TinyCLR_TypeSystem.TinyCLRTokenFromMethodIndex(methodIndex); function = assembly.GetFunctionFromTokenTinyCLR(tk); } return(function); }
private void CreateAppDomainFromId(uint id) { CorDebugAppDomain appDomain = new CorDebugAppDomain(this, id); m_appDomains.Add(appDomain); EnqueueEvent(new ManagedCallbacks.ManagedCallbackAppDomain(appDomain, ManagedCallbacks.ManagedCallbackAppDomain.EventType.CreateAppDomain)); }
public CorDebugBreakpoint(CorDebugAppDomain appDomain) : base(appDomain) { this.Kind = BreakpointDef.c_HARD; }
public CorDebugAssembly GetAssembly( CorDebugAppDomain appDomain ) { return appDomain.AssemblyFromIdx( m_assembly.Idx ); }
public CorDebugGenericType(CorElementType elemType, RuntimeValue rtv, CorDebugAppDomain appDomain) { m_elemType = elemType; m_rtv = rtv; m_appDomain = appDomain; }
public CorDebugAssembly( CorDebugProcess process, string name, Pdbx.PdbxFile pdbxFile, uint idx ) { m_process = process; m_appDomain = null; m_name = name; m_pdbxFile = pdbxFile; m_pdbxAssembly = (pdbxFile != null) ? pdbxFile.Assembly : null; m_htTokenCLRToPdbx = new Hashtable(); m_htTokenTinyCLRToPdbx = new Hashtable(); m_idx = idx; m_primaryAssembly = null; m_isFrameworkAssembly = false; if(m_pdbxAssembly != null) { if (!string.IsNullOrEmpty(pdbxFile.PdbxPath)) { string pth = pdbxFile.PdbxPath.ToLower(); if (pth.Contains(@"\buildoutput\")) { #region V4_1_FRAMEWORK_ASSEMBLIES List<string> frameworkAssemblies = new List<string> { "mfdpwsclient", "mfdpwsdevice", "mfdpwsextensions", "mfwsstack", "microsoft.spot.graphics", "microsoft.spot.hardware", "microsoft.spot.hardware.serialport", "microsoft.spot.hardware.usb", "microsoft.spot.ink", "microsoft.spot.io", "microsoft.spot.native", "microsoft.spot.net", "microsoft.spot.net.security", "microsoft.spot.time", "microsoft.spot.tinycore", "microsoft.spot.touch", "mscorlib", "system.http", "system.io", "system.net.security", "system", "system.xml.legacy", "system.xml", }; #endregion // V4_1_FRAMEWORK_ASSEMBLIES m_isFrameworkAssembly = (frameworkAssemblies.Contains(name.ToLower())); } else { m_isFrameworkAssembly = pdbxFile.PdbxPath.ToLower().Contains(@"\microsoft .net micro framework\"); } } m_pdbxAssembly.CorDebugAssembly = this; foreach(Pdbx.Class c in m_pdbxAssembly.Classes) { AddTokenToHashtables( c.Token, c ); foreach(Pdbx.Field field in c.Fields) { AddTokenToHashtables( field.Token, field ); } foreach(Pdbx.Method method in c.Methods) { AddTokenToHashtables( method.Token, method ); } } } }
public static CorDebugFunction CorDebugFunctionFromMethodIndex (uint methodIndex, CorDebugAppDomain appDomain) { CorDebugFunction function = null; CorDebugAssembly assembly = appDomain.AssemblyFromIdx (TinyCLR_TypeSystem.IdxAssemblyFromIndex (methodIndex)); if (assembly != null) { uint tk = TinyCLR_TypeSystem.TinyCLRTokenFromMethodIndex (methodIndex); function = assembly.GetFunctionFromTokenTinyCLR (tk); } return function; }
public static CorDebugClass CorDebugClassFromTypeIndex (uint typeIndex, CorDebugAppDomain appDomain) { CorDebugClass cls = null; CorDebugAssembly assembly = appDomain.AssemblyFromIdx (TinyCLR_TypeSystem.IdxAssemblyFromIndex (typeIndex)); if (assembly != null) { uint typedef = TinyCLR_TypeSystem.CLR_TkFromType (TinyCLR_TypeSystem.CLR_TABLESENUM.TBL_TypeDef, TinyCLR_TypeSystem.IdxFromIndex (typeIndex)); cls = assembly.GetClassFromTokenTinyCLR (typedef); } return cls; }
public CorDebugAssembly CreateAssemblyInstance( CorDebugAppDomain appDomain ) { //Ensure the metadata import is created. IMetaDataImport iMetaDataImport = this.MetaDataImport; CorDebugAssembly assm = (CorDebugAssembly)MemberwiseClone(); assm.m_appDomain = appDomain; assm.m_primaryAssembly = this; return assm; }