public override void Append(ErrorInfo errorInfo) { Assembly assembly = errorInfo.GetType().Assembly; var pairs = new Dictionary<string, string>(); pairs.Add("Date", DateTime.Now.ToString()); pairs.Add("Culture", CultureInfo.CurrentCulture.Name); #if !SILVERLIGHT pairs.Add("User", string.Format(CultureInfo.InvariantCulture, @"{0}\{1}", Environment.UserDomainName, Environment.UserName).Trim('\\')); pairs.Add("Machine Name", Environment.MachineName); pairs.Add("App Start Time", Process.GetCurrentProcess().StartTime.ToLocalTime().ToString(CultureInfo.InvariantCulture)); pairs.Add("App Up Time", (DateTime.Now - Process.GetCurrentProcess().StartTime.ToLocalTime()).ToString()); pairs.Add("Worker process", GetWorkerProcess()); pairs.Add("AppDomain", AppDomainDetail(AppDomain.CurrentDomain)); pairs.Add("Deployment", (assembly.GlobalAssemblyCache) ? "GAC" : "bin"); #endif pairs.Add("Thread Id", Thread.CurrentThread.ManagedThreadId.ToString(CultureInfo.InvariantCulture)); pairs.Add("Full Name", new AssemblyName(assembly.FullName).FullName); pairs.Add("Operating System Version", Environment.OSVersion.ToString()); pairs.Add("Common Language Runtime Version", Environment.Version.ToString()); pairs.Add("Elmah.Everywhere Version", new AssemblyName(typeof(Diagnostics.ExceptionHandler).Assembly.FullName).Version.ToString()); errorInfo.AddDetail(this.Name, pairs); }
/// <summary> /// When overridden in a derived class, sets the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> with information about the exception. /// </summary> /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown.</param> /// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination.</param> /// <PermissionSet> /// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="*AllFiles*" PathDiscovery="*AllFiles*" /> /// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="SerializationFormatter" /> /// </PermissionSet> public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); info.AddValue("ErrorInfo", ErrorInfo, ErrorInfo.GetType()); }