/// <summary> /// Add all of the default information to the error. This information can be controlled from the server configuration /// values, application configuration, and any registered plugins. /// </summary> /// <param name="error">The error model.</param> /// <param name="pluginContextData"> /// Any contextual data objects to be used by Exceptionless plugins to gather default /// information for inclusion in the report information. /// </param> /// <param name="client"> /// The ExceptionlessClient instance used for configuration. If a client is not specified, it will use /// ExceptionlessClient.Current. /// </param> public static void AddDefaultInformation(this Error error, IDictionary <string, object> pluginContextData = null, ExceptionlessClient client = null) { if (client == null) { client = ExceptionlessClient.Current; } ClientConfiguration configuration = client.Configuration; if (client.Configuration.IncludePrivateInformation) { error.UserName = Environment.UserName; } try { error.EnvironmentInfo = EnvironmentInfoCollector.Collect(); } catch (Exception ex) { client.Log.FormattedError(typeof(ErrorExtensions), ex, "Error adding machine information: {0}", ex.Message); } #if !SILVERLIGHT try { if (configuration.TraceLogLimit > 0) { AddRecentTraceLogEntries(error); } } catch (Exception ex) { client.Log.FormattedError(typeof(ErrorExtensions), ex, "Error adding trace information: {0}", ex.Message); } #endif foreach (string tag in client.Tags) { error.Tags.Add(tag); } foreach (IExceptionlessPlugin plugin in client.Plugins) { try { plugin.AddDefaultInformation(new ExceptionlessPluginContext(client, pluginContextData), error); } catch (Exception ex) { client.Log.FormattedError(typeof(ErrorExtensions), ex, "Error adding default information: {0}", ex.Message); } } #if !SILVERLIGHT ExceptionlessSection settings = ClientConfigurationReader.GetApplicationConfiguration(client); if (settings == null) { return; } foreach (NameValueConfigurationElement cf in settings.ExtendedData) { if (!String.IsNullOrEmpty(cf.Name)) { error.ExtendedData[cf.Name] = cf.Value; } } foreach (string tag in settings.Tags.SplitAndTrim(',')) { if (!String.IsNullOrEmpty(tag)) { error.Tags.Add(tag); } } #endif }
public void ToXml() { EnvironmentInfo info = EnvironmentInfoCollector.Collect(); Assert.NotNull(info); }