private static void ExecuteWinDbg(IntPtr client, string args, DebuggingMethod callback) { if (ChildDomain == null) { var assemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); ChildDomain = AppDomain.CreateDomain("WinDbgExtension", AppDomain.CurrentDomain.Evidence, assemblyPath, ".", false); } var invoker = new CrossDomainInvoker(client, args, callback.Method.DeclaringType.AssemblyQualifiedName, callback.Method.MetadataToken); ChildDomain.DoCallBack(invoker.Invoke); }
public static void Execute(IntPtr client, string args, DebuggingMethod callback) { if (!callback.Method.IsStatic) { Console.WriteLine("The callback given to DebuggingContext.Execute needs to be a static method"); return; } if (IsWinDbg) { ExecuteWinDbg(client, args, callback); } else { if (Runtime == null) { Initialize(client, false); } callback(Runtime, args); } }