public int OnCustomDebugEvent(ref Guid ProcessId, VsComponentMessage message) { try { VsPackageMessage code = (VsPackageMessage)message.MessageCode; switch (code) { case VsPackageMessage.AttachToChild: int parentId = (int)message.Parameter1; int childId = (int)message.Parameter2; Process proc = Process.GetProcessById(childId); if (proc != null) { DebugAttach.AttachToProcess(new Process[] { proc }, ChildDebuggingMode.AlwaysAttach); } break; case VsPackageMessage.IsChildDebuggingEnabled: Guid processGuid = (Guid)message.Parameter1; Guid connectionGuid = (Guid)message.Parameter2; DkmTransportConnection connection = DkmTransportConnection.FindConnection(connectionGuid); if (connection != null) { if (IsChildDebuggingEnabledByDefault) { DkmCustomMessage response = DkmCustomMessage.Create( connection, null, PackageServices.VsDebuggerMessageGuid, (int)VsDebuggerMessage.EnableChildProcessDebugging, processGuid, null ); response.SendLower(); } else { Logger.Log( "Not enabling child process debugging for process {0}. " + "Child debugging is disabled by default.", processGuid); } } break; } } catch (Exception exception) { Logger.LogException( exception, "An error occured while handling a VsPackage message. HR=0x{0:X}", exception.HResult); } return(0); }
public AD7CustomEvent(VsPackageMessage message, object param1 = null, object param2 = null) : this(new VsComponentMessage { MessageCode = (uint)message, Parameter1 = param1, Parameter2 = param2 }) { }
public AD7CustomEvent(VsPackageMessage message, object param1 = null, object param2 = null) : this(new VsComponentMessage { MessageCode = (uint)message, Parameter1 = param1, Parameter2 = param2 }) { }