Esempio 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 = _reportInfo.ExceptionDateKind != DateTimeKind.Local ? DateTime.UtcNow : DateTime.Now;
            _reportInfo.RegionInfo    = Application.CurrentCulture.DisplayName;

            _reportInfo.AppName    = string.IsNullOrEmpty(_reportInfo.AppName) ? Application.ProductName : _reportInfo.AppName;
            _reportInfo.AppVersion = string.IsNullOrEmpty(_reportInfo.AppVersion) ? GetAppVersion() : _reportInfo.AppVersion;
            if (_reportInfo.AppAssembly == null)
            {
                _reportInfo.AppAssembly = Assembly.GetEntryAssembly() ?? Assembly.GetCallingAssembly();
            }
        }
Esempio n. 2
0
 public ExceptionReportBuilder(ExceptionReportInfo reportInfo, IEnumerable <SysInfoResult> sysInfoResults)
     : this(reportInfo)
 {
     _sysInfoResults = sysInfoResults;
 }
Esempio n. 3
0
 /// <summary>
 /// Construct an ExceptionReport from a StringBuilder
 /// </summary>
 public ExceptionReport(StringBuilder stringBuilder, ExceptionReportInfo reportInfo, IList <SysInfoResult> sysInfoResults)
 {
     _reportString   = stringBuilder;
     _reportInfo     = reportInfo;
     _sysInfoResults = sysInfoResults;
 }
Esempio n. 4
0
 private ExceptionReportBuilder(ExceptionReportInfo reportInfo)
 {
     _reportInfo = reportInfo;
 }