/// <summary>
        /// Initialises some ExceptionReportInfo properties related to the application/system
        /// </summary>
        /// <param name="reportInfo">an ExceptionReportInfo, can be pre-populated with config
        /// however 'base' properties such as MachineName</param>
        public ExceptionReportGenerator(ExceptionReportInfo reportInfo)
        {
            _reportInfo = reportInfo ?? throw new ExceptionReportGeneratorException("reportInfo cannot be null");

            _reportInfo.ExceptionDate = DateTime.UtcNow;
            _reportInfo.UserName      = Environment.UserName;
            _reportInfo.MachineName   = Environment.MachineName;
            _reportInfo.AppName       = Application.ProductName;                // TODO Application is WPF/WinForm specific, replace
            _reportInfo.RegionInfo    = Application.CurrentCulture.DisplayName;
            _reportInfo.AppVersion    = Application.ProductVersion;

            if (_reportInfo.AppAssembly == null)
            {
                _reportInfo.AppAssembly = Assembly.GetEntryAssembly() ?? Assembly.GetCallingAssembly();
            }
        }
 public ExceptionReportBuilder(ExceptionReportInfo reportInfo)
 {
     _reportInfo = reportInfo;
 }
 public ExceptionReportBuilder(ExceptionReportInfo reportInfo, IEnumerable <SysInfoResult> sysInfoResults)
     : this(reportInfo)
 {
     _sysInfoResults = sysInfoResults;
 }
Example #4
0
        /// <summary>
        /// Construct an ExceptionReport from a StringBuilder
        /// </summary>
        public ExceptionReport(StringBuilder stringBuilder, ExceptionReportInfo reportInfo)
        {
            _reportString = stringBuilder;

            ReportInfo = reportInfo;
        }