Exemplo n.º 1
0
        /// <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();
            }
        }
Exemplo n.º 2
0
 public ExceptionReportBuilder(ExceptionReportInfo reportInfo)
 {
     _reportInfo = reportInfo;
 }
Exemplo n.º 3
0
 public ExceptionReportBuilder(ExceptionReportInfo reportInfo, IEnumerable <SysInfoResult> sysInfoResults)
     : this(reportInfo)
 {
     _sysInfoResults = sysInfoResults;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Construct an ExceptionReport from a StringBuilder
        /// </summary>
        public ExceptionReport(StringBuilder stringBuilder, ExceptionReportInfo reportInfo)
        {
            _reportString = stringBuilder;

            ReportInfo = reportInfo;
        }