public int Event( IDebugEngine2 pEngine, IDebugProcess2 pProcess, IDebugProgram2 pProgram, IDebugThread2 pThread, IDebugEvent2 pEvent, ref Guid riidEvent, uint dwAttrib ) { if (riidEvent == typeof(IDebugProgramCreateEvent2).GUID) { RaiseStartEvent(); } else if (riidEvent == typeof(IDebugMessageEvent2).GUID) { IDebugMessageEvent2 debugMessageEvent = pEvent as IDebugMessageEvent2; enum_MESSAGETYPE[] messageTypes = new enum_MESSAGETYPE[2]; messageTypes[0] = enum_MESSAGETYPE.MT_OUTPUTSTRING; messageTypes[1] = enum_MESSAGETYPE.MT_REASON_TRACEPOINT; string message; uint dwType; string helpFilename; uint helpId; debugMessageEvent.GetMessage(messageTypes, out message, out dwType, out helpFilename, out helpId); // MessageEvents always have a \n on the end message = message.TrimEnd(Environment.NewLine.ToCharArray()); RaiseDebugMessageEvent(message); } return(0); }
public AD7MessageEvent(string msg, enum_MESSAGETYPE messageType, bool isAsync, Severity severity) { _message = msg; _messageType = messageType; _isAsync = isAsync; _severity = severity; }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public int OnError(IDebugEngine2 pEngine, IDebugProcess2 pProcess, IDebugProgram2 pProgram, IDebugThread2 pThread, IDebugEvent2 pEvent, ref Guid riidEvent, uint dwAttrib) { LoggingUtils.PrintFunction(); try { DebugEngineEvent.Error errorEvent = pEvent as DebugEngineEvent.Error; enum_MESSAGETYPE [] messageType = new enum_MESSAGETYPE [1]; string errorFormat, errorHelpFileName; int errorReason; uint errorType, errorHelpId; LoggingUtils.RequireOk(errorEvent.GetErrorMessage(messageType, out errorFormat, out errorReason, out errorType, out errorHelpFileName, out errorHelpId)); LoggingUtils.RequireOk(m_debuggerConnectionService.LaunchDialogUpdate(errorFormat, true)); return(VSConstants.S_OK); } catch (Exception e) { LoggingUtils.HandleException(e); return(VSConstants.E_FAIL); } }
public OutputMessage(string message, enum_MESSAGETYPE messageType, Severity severity, uint errorCode = 0) { this.Message = message; this.MessageType = messageType; this.SeverityValue = severity; this.ErrorCode = errorCode; }
public OutputMessage(string message, enum_MESSAGETYPE messageType, Severity severity, uint errorCode = 0) { this.Message = message; this.MessageType = messageType; this.SeverityValue = severity; this.ErrorCode = errorCode; }
public DebugErrorEvent(enum_EVENTATTRIBUTES attributes, enum_MESSAGETYPE messageType, string format, int reason, MessageBoxIcon severity, string helpFileName = null, uint helpId = 0) : base(attributes) { _messageType = messageType; _format = format; _reason = reason; _severity = severity; _helpFileName = helpFileName; _helpId = helpId; }
public DebugMessageEvent(enum_EVENTATTRIBUTES attributes, enum_MESSAGETYPE messageType, string message, MessageBoxIcon severity, string helpFileName = null, uint helpId = 0) : base(attributes) { Contract.Requires<ArgumentNullException>(message != null, "message"); Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(message)); _messageType = messageType; _message = message; _severity = severity; _helpFileName = helpFileName; _helpId = helpId; }
public DebugMessageEvent(enum_EVENTATTRIBUTES attributes, enum_MESSAGETYPE messageType, string message, MessageBoxIcon severity, string helpFileName = null, uint helpId = 0) : base(attributes) { Contract.Requires <ArgumentNullException>(message != null, "message"); Contract.Requires <ArgumentException>(!string.IsNullOrEmpty(message)); _messageType = messageType; _message = message; _severity = severity; _helpFileName = helpFileName; _helpId = helpId; }
public void OnOutputMessage(string outputMessage, enum_MESSAGETYPE messageType) { try { var eventObject = new AD7MessageEvent(outputMessage, messageType, isAsync: false, severity: AD7MessageEvent.Severity.Warning); Send(eventObject, AD7MessageEvent.IID, null); } catch { // Since we are often trying to report an exception, if something goes wrong we don't want to take down the process, // so ignore the failure. } }
public int GetMessage(enum_MESSAGETYPE[] pMessageType, out string pbstrMessage, out uint pdwType, out string pbstrHelpFileName, out uint pdwHelpId) { if (pMessageType == null) throw new ArgumentNullException("pMessageType"); if (pMessageType.Length == 0) throw new ArgumentException(); pMessageType[0] = _messageType; pbstrMessage = _message; pdwType = (uint)_severity; pbstrHelpFileName = _helpFileName; pdwHelpId = _helpId; return VSConstants.S_OK; }
public AD7MessageEvent(string msg, enum_MESSAGETYPE messageType, bool isAsync, Severity severity) { _message = msg; _messageType = messageType; _isAsync = isAsync; _severity = severity; }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public int OnError (IDebugEngine2 pEngine, IDebugProcess2 pProcess, IDebugProgram2 pProgram, IDebugThread2 pThread, IDebugEvent2 pEvent, ref Guid riidEvent, uint dwAttrib) { LoggingUtils.PrintFunction (); try { DebugEngineEvent.Error errorEvent = pEvent as DebugEngineEvent.Error; enum_MESSAGETYPE [] messageType = new enum_MESSAGETYPE [1]; string errorFormat, errorHelpFileName; int errorReason; uint errorType, errorHelpId; LoggingUtils.RequireOk (errorEvent.GetErrorMessage (messageType, out errorFormat, out errorReason, out errorType, out errorHelpFileName, out errorHelpId)); LoggingUtils.RequireOk (m_debuggerConnectionService.LaunchDialogUpdate (errorFormat, true)); return VSConstants.S_OK; } catch (Exception e) { LoggingUtils.HandleException (e); return VSConstants.E_FAIL; } }
int IDebugErrorEvent2.GetErrorMessage(enum_MESSAGETYPE[] pMessageType, out string errorFormat, out int hrErrorReason, out uint pdwType, out string helpFilename, out uint pdwHelpId) { hrErrorReason = unchecked((int)_outputMessage.ErrorCode); return AD7MessageEvent.ConvertMessageToAD7(_outputMessage, pMessageType, out errorFormat, out pdwType, out helpFilename, out pdwHelpId); }
int IDebugMessageEvent2.GetMessage (enum_MESSAGETYPE [] pMessageType, out string pbstrMessage, out uint pdwType, out string pbstrHelpFileName, out uint pdwHelpId) { pMessageType [0] = ((m_msgBoxPrompt) ? enum_MESSAGETYPE.MT_MESSAGEBOX : enum_MESSAGETYPE.MT_OUTPUTSTRING) & enum_MESSAGETYPE.MT_TYPE_MASK; pbstrMessage = m_userMessage; pdwType = 0; pbstrHelpFileName = string.Empty; pdwHelpId = 0; return Constants.S_OK; }
internal static int ConvertMessageToAD7(OutputMessage outputMessage, enum_MESSAGETYPE[] pMessageType, out string pbstrMessage, out uint pdwType, out string pbstrHelpFileName, out uint pdwHelpId) { const uint MB_ICONERROR = 0x00000010; const uint MB_ICONWARNING = 0x00000030; pMessageType[0] = outputMessage.MessageType; pbstrMessage = outputMessage.Message; pdwType = 0; if ((outputMessage.MessageType & enum_MESSAGETYPE.MT_TYPE_MASK) == enum_MESSAGETYPE.MT_MESSAGEBOX) { switch (outputMessage.SeverityValue) { case OutputMessage.Severity.Error: pdwType |= MB_ICONERROR; break; case OutputMessage.Severity.Warning: pdwType |= MB_ICONWARNING; break; } } pbstrHelpFileName = null; pdwHelpId = 0; return Constants.S_OK; }
int IDebugMessageEvent2.GetMessage(enum_MESSAGETYPE[] pMessageType, out string pbstrMessage, out uint pdwType, out string pbstrHelpFileName, out uint pdwHelpId) { return ConvertMessageToAD7(_outputMessage, pMessageType, out pbstrMessage, out pdwType, out pbstrHelpFileName, out pdwHelpId); }
public int GetErrorMessage (enum_MESSAGETYPE [] pMessageType, out string pbstrErrorFormat, out int phrErrorReason, out uint pdwType, out string pbstrHelpFileName, out uint pdwHelpId) { LoggingUtils.PrintFunction (); pMessageType [0] = ((m_errorIsCritical) ? enum_MESSAGETYPE.MT_MESSAGEBOX : enum_MESSAGETYPE.MT_OUTPUTSTRING) & enum_MESSAGETYPE.MT_TYPE_MASK; pbstrErrorFormat = m_errorMessage; phrErrorReason = 0; pdwType = 0x10; pbstrHelpFileName = string.Empty; pdwHelpId = 0; return Constants.S_OK; }
int IDebugMessageEvent2.GetMessage(enum_MESSAGETYPE[] pMessageType, out string pbstrMessage, out uint pdwType, out string pbstrHelpFileName, out uint pdwHelpId) { const uint MB_ICONERROR = 0x00000010; const uint MB_ICONWARNING = 0x00000030; pMessageType[0] = _messageType; pbstrMessage = _message; pdwType = 0; if (_messageType == enum_MESSAGETYPE.MT_MESSAGEBOX) { switch (_severity) { case Severity.Error: pdwType |= MB_ICONERROR; break; case Severity.Warning: pdwType |= MB_ICONWARNING; break; } } pbstrHelpFileName = null; pdwHelpId = 0; return Constants.S_OK; }
public void OnOutputMessage(string outputMessage, enum_MESSAGETYPE messageType) { try { var eventObject = new AD7MessageEvent(outputMessage, messageType, isAsync: false, severity: AD7MessageEvent.Severity.Warning); Send(eventObject, AD7MessageEvent.IID, null); } catch { // Since we are often trying to report an exception, if something goes wrong we don't want to take down the process, // so ignore the failure. } }