Beispiel #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)
        {
            if (reportInfo == null)
            {
                throw new ExceptionReportGeneratorException("reportInfo cannot be null");
            }

            _reportInfo = reportInfo;

            _reportInfo.ExceptionDate = DateTime.UtcNow;
            _reportInfo.UserName      = Environment.UserName;
            _reportInfo.MachineName   = Environment.MachineName;
            _reportInfo.RegionInfo    = Application.CurrentCulture.DisplayName;

            // TODO Application is WPF/WinForm specific, replace
            _reportInfo.AppName = string.IsNullOrEmpty(_reportInfo.AppName)
                                      ? Application.ProductName
                                      : _reportInfo.AppName;
            _reportInfo.AppVersion = string.IsNullOrEmpty(_reportInfo.AppVersion)
                                         ? Application.ProductVersion
                                         : _reportInfo.AppVersion;

            if (_reportInfo.AppAssembly == null)
            {
                _reportInfo.AppAssembly = Assembly.GetEntryAssembly() ?? Assembly.GetCallingAssembly();
            }
        }
 public ExceptionReportBuilder(ExceptionReportInfo reportInfo, IEnumerable <SysInfoResult> sysInfoResults)
     : this(reportInfo)
 {
     _sysInfoResults = sysInfoResults;
 }
 public ExceptionReportBuilder(ExceptionReportInfo reportInfo)
 {
     _reportInfo = reportInfo;
 }