tools/VsIdeHostAdapter/TargetAddIn/AgentSide/VsIdeHostAdapter.cs
/// <summary>
/// Takes an event record, and writes the properties into a string builder.
/// This assumes that the event is a .Net Runtime Provider EventID 1026, which only has one property
/// that is a Crash Report for Visual Studio.
/// </summary>
/// <param name="events">StringBuilder to write the properties to.</param>
/// <param name="eventLogEntry">EventRecord to extract properties from</param>
Takes an event record, and writes the properties into a string builder.
This assumes that the event is a .Net Runtime Provider EventID 1026, which only has one property
that is a Crash Report for Visual Studio.
Takes an event record and writes the properties into a string builder . This assumes that the event is a . Net Runtime Provider EventID 1026 which only has one property that is a Crash Report for Visual Studio .
private void WriteCrashReport(StringBuilder events, EventRecord eventLogEntry)
        {
            if (eventLogEntry == null)
                return;
            EventProperty eventProperty = eventLogEntry.Properties.FirstOrDefault();
            if (eventProperty != null)
            {
                int stringBuildInitialLength = events.Length;
                if (eventLogEntry.TimeCreated.HasValue)
                {
                    events.Append("Event Log Time: ");
                    events.AppendLine(eventLogEntry.TimeCreated.Value.ToLocalTime().ToString());
                }
                String crashReport = eventProperty.Value.ToString();
                crashReport = crashReport.Replace(" at ",               Environment.NewLine + " at ");
                crashReport = crashReport.Replace("Framework Version:", Environment.NewLine + "Framework Version:");
                crashReport = crashReport.Replace("Description:",       Environment.NewLine + "Description:");
                crashReport = crashReport.Replace("Exception Info:",    Environment.NewLine + "Exception Info:" + Environment.NewLine);
                crashReport = crashReport.Replace("Stack:",             Environment.NewLine + "Stack:");
                events.AppendLine(crashReport);
            }
        }
private void WriteCrashReport ( StringBuilder events , EventRecord eventLogEntry ) { if ( eventLogEntry == null ) return ; EventProperty eventProperty = eventLogEntry . Properties . FirstOrDefault ( ) ; if ( eventProperty != null ) { int stringBuildInitialLength = events . Length ; if ( eventLogEntry . TimeCreated . HasValue ) { events . Append ( " " ) ; events . AppendLine ( eventLogEntry . TimeCreated . Value . ToLocalTime ( ) . ToString ( ) ) ; } String crashReport = eventProperty . Value . ToString ( ) ; crashReport = crashReport . Replace ( " " , Environment . NewLine + " " ) ; crashReport = crashReport . Replace ( " " , Environment . NewLine + " " ) ; crashReport = crashReport . Replace ( " " , Environment . NewLine + " " ) ; crashReport = crashReport . Replace ( " " , Environment . NewLine + " " + Environment . NewLine ) ; crashReport = crashReport . Replace ( " " , Environment . NewLine + " " ) ; events . AppendLine ( crashReport ) ; } }
Takes an event record, and writes the properties into a string builder.
Takes an event record and writes the properties into a string builder .
// We assume that this .Net Runtime Provider EventID 1026, which only has one property
events
StringBuilder
StringBuilder to write the properties to.
StringBuilder to write the properties to .
eventLogEntry
EventRecord
EventRecord to extract properties from
EventRecord to extract properties from