public void Run(EventPluginContext context) { if (!context.ContextData.ContainsKey("HttpActionContext")) return; HttpActionContext actionContext = context.ContextData.GetHttpActionContext(); if (actionContext == null) return; IPrincipal principal = GetPrincipal(actionContext.Request); if (context.Client.Configuration.IncludePrivateInformation && principal != null && principal.Identity.IsAuthenticated) context.Event.SetUserIdentity(principal.Identity.Name); RequestInfo requestInfo = null; try { requestInfo = actionContext.GetRequestInfo(context.Client.Configuration); } catch (Exception ex) { context.Log.Error(typeof(ExceptionlessWebApiPlugin), ex, "Error adding request info."); } if (requestInfo == null) return; var error = context.Event.GetError(context.Client.Configuration.Resolver.GetJsonSerializer()); if (error != null && error.Code == "404") { context.Event.Type = Event.KnownTypes.NotFound; context.Event.Source = requestInfo.GetFullPath(includeHttpMethod: true, includeHost: false, includeQueryString: false); } context.Event.AddRequestInfo(requestInfo); }
public void ErrorPlugin_IgnoredProperties() { var exception = new MyApplicationException("Test") { IgnoredProperty = "Test", RandomValue = "Test" }; var errorPlugins = new List<IEventPlugin> { new ErrorPlugin(), new SimpleErrorPlugin() }; foreach (var plugin in errorPlugins) { var client = new ExceptionlessClient(); var context = new EventPluginContext(client, new Event()); context.ContextData.SetException(exception); plugin.Run(context); IData error = context.Event.GetError() as IData ?? context.Event.GetSimpleError(); Assert.NotNull(error); Assert.True(error.Data.ContainsKey(Error.KnownDataKeys.ExtraProperties)); var json = error.Data[Error.KnownDataKeys.ExtraProperties] as string; Assert.Equal("{\"ignored_property\":\"Test\",\"random_value\":\"Test\"}", json); client.Configuration.AddDataExclusions("Ignore*"); context = new EventPluginContext(client, new Event()); context.ContextData.SetException(exception); plugin.Run(context); error = context.Event.GetError() as IData ?? context.Event.GetSimpleError(); Assert.NotNull(error); Assert.True(error.Data.ContainsKey(Error.KnownDataKeys.ExtraProperties)); json = error.Data[Error.KnownDataKeys.ExtraProperties] as string; Assert.Equal("{\"random_value\":\"Test\"}", json); } }
public void Run(EventPluginContext context) { var httpContext = context.ContextData.GetHttpContext(); var serializer = context.Client.Configuration.Resolver.GetJsonSerializer(); if (context.Client.Configuration.IncludePrivateInformation) AddUser(context, httpContext, serializer); if (httpContext == null) return; var ri = context.Event.GetRequestInfo(serializer); if (ri != null) return; try { ri = httpContext.GetRequestInfo(context.Client.Configuration); } catch (Exception ex) { context.Log.Error(typeof(ExceptionlessAspNetCorePlugin), ex, "Error adding request info."); } if (ri == null) return; var error = context.Event.GetError(serializer); if (error != null && error.Code == "404") { context.Event.Type = Event.KnownTypes.NotFound; context.Event.Source = ri.GetFullPath(includeHttpMethod: true, includeHost: false, includeQueryString: false); } context.Event.AddRequestInfo(ri); }
public void Run(EventPluginContext context) { //error.ExceptionlessClientInfo.Platform = "Nancy"; var nancyContext = context.ContextData.GetNancyContext(); if (nancyContext == null) return; if (nancyContext.CurrentUser != null && context.Client.Configuration.IncludePrivateInformation) context.Event.SetUserIdentity(nancyContext.CurrentUser.UserName); RequestInfo requestInfo = null; try { requestInfo = nancyContext.GetRequestInfo(context.Client.Configuration); } catch (Exception ex) { context.Log.Error(typeof(ExceptionlessNancyPlugin), ex, "Error adding request info."); } if (requestInfo == null) return; if (context.Event.Type == Event.KnownTypes.NotFound) { context.Event.Source = requestInfo.GetFullPath(includeHttpMethod: true, includeHost: false, includeQueryString: false); context.Event.Data.Clear(); } context.Event.AddRequestInfo(requestInfo); }
public void EnvironmentInfo_IncorrectEventType(string eventType) { var client = new ExceptionlessClient(); var context = new EventPluginContext(client, new Event { Type = eventType }); var plugin = new EnvironmentInfoPlugin(); plugin.Run(context); Assert.Equal(0, context.Event.Data.Count); }
public void Run(EventPluginContext context) { if (!context.Client.Configuration.IncludePrivateInformation) return; var user = context.Event.GetUserIdentity(context.Client.Configuration.Resolver.GetJsonSerializer()); if (user == null) context.Event.SetUserIdentity(Environment.UserName); }
public void Run(EventPluginContext context) { if (!context.Client.Configuration.IncludePrivateInformation) return; var user = context.Event.GetUserIdentity(); if (user == null || String.IsNullOrEmpty(user.Identity)) context.Event.SetUserIdentity(Environment.UserName); }
public void Run(EventPluginContext context) { var exception = context.ContextData.GetException(); if (exception == null) return; context.Event.Type = Event.KnownTypes.Error; context.Event.Data[Event.KnownDataKeys.Error] = exception.ToErrorModel(context.Client); }
private static void AddUser(EventPluginContext context, HttpActionContext actionContext, IJsonSerializer serializer) { var user = context.Event.GetUserIdentity(serializer); if (user != null) return; var principal = GetPrincipal(actionContext != null ? actionContext.Request : null); if (principal != null && principal.Identity.IsAuthenticated) context.Event.SetUserIdentity(principal.Identity.Name); }
public void EnvironmentInfo_ShouldAddSessionStart() { var client = new ExceptionlessClient(); var context = new EventPluginContext(client, new Event { Type = Event.KnownTypes.SessionStart }); var plugin = new EnvironmentInfoPlugin(); plugin.Run(context); Assert.Equal(1, context.Event.Data.Count); Assert.NotNull(context.Event.Data[Event.KnownDataKeys.EnvironmentInfo]); }
private static void AddUser(EventPluginContext context, HttpContext httpContext, IJsonSerializer serializer) { var user = context.Event.GetUserIdentity(serializer); if (user != null) return; // TODO: Should we fall back to Thread.CurrentPrincipal? var principal = httpContext?.User; if (principal != null && principal.Identity.IsAuthenticated) context.Event.SetUserIdentity(principal.Identity.Name); }
public void Run(EventPluginContext context) { // Only update feature usage events. if (context.Event.Type != Event.KnownTypes.FeatureUsage) return; var uptime = TimeSpan.FromSeconds((double)Stopwatch.GetTimestamp() / Stopwatch.Frequency); // Store the system uptime as an extended property. context.Event.SetProperty("System Uptime", $"{uptime.Days} Days {uptime.Hours} Hours {uptime.Minutes} Minutes {uptime.Seconds} Seconds"); }
public void Run(EventPluginContext context) { var request = context.Event.GetRequestInfo(); if (request == null) return; if (request.UserAgent.AnyWildcardMatches(context.Client.Configuration.UserAgentBotPatterns, true)) { context.Log.Info(String.Concat("Cancelling event as the request infos user agent matches a known bot pattern: ", request.UserAgent), typeof(IgnoreUserAgentPlugin).Name); context.Cancel = true; } }
private static void AddUser(EventPluginContext context, HttpContextBase httpContext, IJsonSerializer serializer) { var user = context.Event.GetUserIdentity(serializer); if (user != null) return; if (httpContext != null && httpContext.User != null && httpContext.User.Identity.IsAuthenticated) context.Event.SetUserIdentity(httpContext.User.Identity.Name); else if (Thread.CurrentPrincipal != null && Thread.CurrentPrincipal.Identity.IsAuthenticated) context.Event.SetUserIdentity(Thread.CurrentPrincipal.Identity.Name); }
public void LargeEventsFromFiles() { foreach (var ev in _events) { var pluginContextData = new ContextData(); for (int index = 0; index < 2; index++) { var context = new EventPluginContext(_client, ev, pluginContextData); _errorPlugin.Run(context); _duplicateCheckerPlugin.Run(context); } } }
public void EnvironmentInfo_CanRunInParallel() { var client = new ExceptionlessClient(); var ev = new Event { Type = Event.KnownTypes.SessionStart }; var plugin = new EnvironmentInfoPlugin(); Parallel.For(0, 10000, i => { var context = new EventPluginContext(client, ev); plugin.Run(context); Assert.Equal(1, context.Event.Data.Count); Assert.NotNull(context.Event.Data[Event.KnownDataKeys.EnvironmentInfo]); }); }
public void Run(EventPluginContext context) { var exception = context.ContextData.GetException(); if (exception == null) { return; } context.Event.Type = Event.KnownTypes.Error; context.Event.Data[Event.KnownDataKeys.Error] = exception.ToErrorModel(_log); }
public void CanCancel() { var client = new ExceptionlessClient(); foreach (var plugin in client.Configuration.Plugins) client.Configuration.RemovePlugin(plugin.Key); client.Configuration.AddPlugin("cancel", 1, ctx => ctx.Cancel = true); client.Configuration.AddPlugin("add-tag", 2, ctx => ctx.Event.Tags.Add("Was Not Canceled")); var context = new EventPluginContext(client, new Event()); EventPluginManager.Run(context); Assert.True(context.Cancel); Assert.Equal(0, context.Event.Tags.Count); }
/// <summary> /// Called when the event object is created and can be used to add information to the event. /// </summary> /// <param name="context">Context information.</param> public static void Run(EventPluginContext context) { foreach (IEventPlugin plugin in context.Client.Configuration.Plugins.Select(e => e.Plugin).ToList()) { try { plugin.Run(context); if (context.Cancel) { context.Log.FormattedInfo(plugin.GetType(), "Event submission cancelled by plugin: id={0} type={1}", context.Event.ReferenceId, context.Event.Type); return; } } catch (Exception ex) { context.Log.FormattedError(typeof(EventPluginManager), ex, "An error occurred while running {0}.Run(): {1}", plugin.GetType().FullName, ex.Message); } } }
public void Run(EventPluginContext context) { if (!context.Client.Configuration.IncludePrivateInformation) { return; } var user = context.Event.GetUserIdentity(context.Client.Configuration.Resolver.GetJsonSerializer()); if (user == null) { context.Event.SetUserIdentity(Environment.UserName); } }
public void Run(EventPluginContext context) { var exception = context.ContextData.GetException(); if (exception == null) return; if (exception.IsProcessed()) { context.Cancel = true; return; } context.Event.Type = Event.KnownTypes.Error; context.Event.Data[Event.KnownDataKeys.Error] = exception.ToErrorModel(context.Client); exception.MarkProcessed(); }
public void Run(EventPluginContext context) { if (!context.Client.Configuration.IncludePrivateInformation) { return; } var user = context.Event.GetUserIdentity(); if (user == null || String.IsNullOrEmpty(user.Identity)) { context.Event.SetUserIdentity(Environment.UserName); } }
public void Run(EventPluginContext context) { var request = context.Event.GetRequestInfo(context.Client.Configuration.Resolver.GetJsonSerializer()); if (request == null) { return; } if (request.UserAgent.AnyWildcardMatches(context.Client.Configuration.UserAgentBotPatterns, true)) { context.Log.Info(String.Concat("Cancelling event as the request infos user agent matches a known bot pattern: ", request.UserAgent), typeof(IgnoreUserAgentPlugin).Name); context.Cancel = true; } }
public void Run(EventPluginContext context) { // Only update feature usage events. if (context.Event.Type != Event.KnownTypes.FeatureUsage) return; // Get the system uptime using (var pc = new PerformanceCounter("System", "System Up Time")) { pc.NextValue(); var uptime = TimeSpan.FromSeconds(pc.NextValue()); // Store the system uptime as an extended property. context.Event.SetProperty("System Uptime", String.Format("{0} Days {1} Hours {2} Minutes {3} Seconds", uptime.Days, uptime.Hours, uptime.Minutes, uptime.Seconds)); } }
public void Run(EventPluginContext context) { if (context.Event.IsSessionStart() || String.IsNullOrEmpty(context.Client.Configuration.CurrentSessionIdentifier)) { context.Client.Configuration.CurrentSessionIdentifier = Guid.NewGuid().ToString("N"); } if (context.Event.IsSessionStart()) { context.Event.ReferenceId = context.Client.Configuration.CurrentSessionIdentifier; } else { context.Event.SetEventReference("session", context.Client.Configuration.CurrentSessionIdentifier); } }
public void ConfigurationDefaults_IgnoredProperties() { var client = new ExceptionlessClient(); client.Configuration.DefaultData.Add("Message", "Test"); var context = new EventPluginContext(client, new Event()); var plugin = new ConfigurationDefaultsPlugin(); plugin.Run(context); Assert.Equal(1, context.Event.Data.Count); Assert.Equal("Test", context.Event.Data["Message"]); client.Configuration.AddDataExclusions("Ignore*"); client.Configuration.DefaultData.Add("Ignored", "Test"); plugin.Run(context); Assert.Equal(1, context.Event.Data.Count); Assert.Equal("Test", context.Event.Data["Message"]); }
public void ConfigurationDefaults_SerializedProperties() { var client = new ExceptionlessClient(); client.Configuration.DefaultData.Add(Event.KnownDataKeys.EnvironmentInfo, new EnvironmentInfo { MachineName = "blake" }); client.Configuration.DefaultData.Add(Event.KnownDataKeys.Error, new Error { Message = "blake" }); client.Configuration.DefaultData.Add(Event.KnownDataKeys.Level, "Debug"); client.Configuration.DefaultData.Add(Event.KnownDataKeys.ManualStackingKey, "blake"); client.Configuration.DefaultData.Add(Event.KnownDataKeys.RequestInfo, new RequestInfo { Host = "blake" }); client.Configuration.DefaultData.Add(Event.KnownDataKeys.SimpleError, new SimpleError { Message = "blake" }); client.Configuration.DefaultData.Add(Event.KnownDataKeys.SubmissionMethod, "test"); client.Configuration.DefaultData.Add(Event.KnownDataKeys.TraceLog, new List<string>()); client.Configuration.DefaultData.Add(Event.KnownDataKeys.UserDescription, new UserDescription("*****@*****.**", "blake")); client.Configuration.DefaultData.Add(Event.KnownDataKeys.UserInfo, new UserInfo("blake")); client.Configuration.DefaultData.Add(Event.KnownDataKeys.Version, "1.0"); var serializer = client.Configuration.Resolver.GetJsonSerializer(); var context = new EventPluginContext(client, new Event()); var plugin = new ConfigurationDefaultsPlugin(); plugin.Run(context); Assert.Equal(11, context.Event.Data.Count); Assert.True(context.Event.Data[Event.KnownDataKeys.EnvironmentInfo] is string); Assert.Equal("blake", context.Event.GetEnvironmentInfo().MachineName); Assert.Equal("blake", context.Event.GetEnvironmentInfo(serializer).MachineName); Assert.True(context.Event.Data[Event.KnownDataKeys.Error] is string); Assert.Equal("blake", context.Event.GetError().Message); Assert.Equal("blake", context.Event.GetError(serializer).Message); Assert.Equal("Debug", context.Event.Data[Event.KnownDataKeys.Level]); Assert.Equal("blake", context.Event.Data[Event.KnownDataKeys.ManualStackingKey]); Assert.True(context.Event.Data[Event.KnownDataKeys.RequestInfo] is string); Assert.Equal("blake", context.Event.GetRequestInfo().Host); Assert.Equal("blake", context.Event.GetRequestInfo(serializer).Host); Assert.True(context.Event.Data[Event.KnownDataKeys.SimpleError] is string); Assert.Equal("blake", context.Event.GetSimpleError().Message); Assert.Equal("blake", context.Event.GetSimpleError(serializer).Message); Assert.Equal("test", context.Event.Data[Event.KnownDataKeys.SubmissionMethod]); Assert.True(context.Event.Data[Event.KnownDataKeys.TraceLog] is string); Assert.True(context.Event.Data[Event.KnownDataKeys.UserDescription] is string); Assert.Equal("blake", context.Event.GetUserDescription().Description); Assert.Equal("blake", context.Event.GetUserDescription(serializer).Description); Assert.True(context.Event.Data[Event.KnownDataKeys.UserInfo] is string); Assert.Equal("blake", context.Event.GetUserIdentity().Identity); Assert.Equal("blake", context.Event.GetUserIdentity(serializer).Identity); Assert.Equal("1.0", context.Event.Data[Event.KnownDataKeys.Version]); }
public void Run(EventPluginContext context) { var exception = context.ContextData.GetException(); if (exception == null) { return; } if (exception.IsProcessed()) { context.Cancel = true; return; } context.Event.Type = Event.KnownTypes.Error; context.Event.Data[Event.KnownDataKeys.Error] = exception.ToErrorModel(context.Client); exception.MarkProcessed(); }
public void Run(EventPluginContext context) { var httpContext = context.ContextData.GetHttpContext(); // if the context is not passed in, try and grab it if (httpContext == null && HttpContext.Current != null) httpContext = HttpContext.Current.ToWrapped(); var serializer = context.Client.Configuration.Resolver.GetJsonSerializer(); if (context.Client.Configuration.IncludePrivateInformation) AddUser(context, httpContext, serializer); if (httpContext == null) return; var tags = httpContext.Items[TAGS_HTTP_CONTEXT_NAME] as TagSet; if (tags != null) context.Event.Tags.UnionWith(tags); var ri = context.Event.GetRequestInfo(serializer); if (ri != null) return; try { ri = httpContext.GetRequestInfo(context.Client.Configuration); } catch (Exception ex) { context.Log.Error(typeof(ExceptionlessWebPlugin), ex, "Error adding request info."); } if (ri == null) return; var httpException = context.ContextData.GetException() as HttpException; if (httpException != null) { int httpCode = httpException.GetHttpCode(); if (httpCode == 404) { context.Event.Type = Event.KnownTypes.NotFound; context.Event.Source = ri.GetFullPath(includeHttpMethod: true, includeHost: false, includeQueryString: false); } } context.Event.AddRequestInfo(ri); }
public void Run(EventPluginContext context) { HttpContextBase httpContext = context.ContextData.GetHttpContext(); // if the context is not passed in, try and grab it if (httpContext == null && HttpContext.Current != null) httpContext = HttpContext.Current.ToWrapped(); if (httpContext == null) return; // ev.ExceptionlessClientInfo.Platform = ".NET Web"; if (context.Client.Configuration.IncludePrivateInformation && httpContext.User != null && httpContext.User.Identity.IsAuthenticated) context.Event.SetUserIdentity(httpContext.User.Identity.Name); var tags = httpContext.Items[TAGS_HTTP_CONTEXT_NAME] as TagSet; if (tags != null) context.Event.Tags.UnionWith(tags); RequestInfo requestInfo = null; try { requestInfo = httpContext.GetRequestInfo(context.Client.Configuration); } catch (Exception ex) { context.Log.Error(typeof(ExceptionlessWebPlugin), ex, "Error adding request info."); } if (requestInfo == null) return; var httpException = context.ContextData.GetException() as HttpException; if (httpException != null) { int httpCode = httpException.GetHttpCode(); if (httpCode == 404) { context.Event.Type = Event.KnownTypes.NotFound; context.Event.Source = requestInfo.GetFullPath(includeHttpMethod: true, includeHost: false, includeQueryString: false); context.Event.Data.Clear(); } } context.Event.AddRequestInfo(requestInfo); }
public void IgnoreUserAgentPlugin_DiscardBot() { var client = new ExceptionlessClient(); client.Configuration.AddUserAgentBotPatterns("*Bot*"); var plugin = new IgnoreUserAgentPlugin(); var ev = new Event(); var context = new EventPluginContext(client, ev); plugin.Run(context); Assert.False(context.Cancel); ev.AddRequestInfo(new RequestInfo { UserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/601.4.4 (KHTML, like Gecko) Version/9.0.3 Safari/601.4.4" }); context = new EventPluginContext(client, ev); plugin.Run(context); Assert.False(context.Cancel); ev.AddRequestInfo(new RequestInfo { UserAgent = "Mozilla/5.0 (compatible; bingbot/2.0 +http://www.bing.com/bingbot.htm)" }); context = new EventPluginContext(client, ev); plugin.Run(context); Assert.True(context.Cancel); }
public void ConfigurationDefaults_EnsureNoDuplicateTagsOrData() { var client = new ExceptionlessClient(); var context = new EventPluginContext(client, new Event()); var plugin = new ConfigurationDefaultsPlugin(); plugin.Run(context); Assert.Equal(0, context.Event.Tags.Count); client.Configuration.DefaultTags.Add(Event.KnownTags.Critical); plugin.Run(context); Assert.Equal(1, context.Event.Tags.Count); Assert.Equal(0, context.Event.Data.Count); client.Configuration.DefaultData.Add("Message", new { Exceptionless = "Is Awesome!" }); for (int index = 0; index < 2; index++) { plugin.Run(context); Assert.Equal(1, context.Event.Tags.Count); Assert.Equal(1, context.Event.Data.Count); } }
public void Run(EventPluginContext context) { if (context.Event.IsSessionStart() || String.IsNullOrEmpty(_sessionId)) { _sessionId = Guid.NewGuid().ToString("N"); } if (context.Event.IsSessionStart()) { context.Event.ReferenceId = _sessionId; } else { context.Event.SetEventReference("session", _sessionId); } if (context.Event.IsSessionEnd()) { _sessionId = null; } }
public void Run(EventPluginContext context) { var aggregateException = context.ContextData.GetException() as AggregateException; if (aggregateException == null) return; var exception = aggregateException.Flatten(); if (exception.InnerExceptions.Count == 1) { context.ContextData.SetException(exception.InnerException); return; } foreach (var ex in exception.InnerExceptions) { var ctx = new ContextData(context.ContextData); ctx.SetException(ex); var serializer = context.Resolver.GetJsonSerializer(); context.Client.SubmitEvent(serializer.Deserialize(serializer.Serialize(context.Event), typeof(Event)) as Event, ctx); } context.Cancel = true; }
public void Run(EventPluginContext context) { if (context.Event.Data.ContainsKey(Event.KnownDataKeys.Version)) return; object value; if (context.Client.Configuration.DefaultData.TryGetValue(Event.KnownDataKeys.Version, out value) && value is string) { context.Event.Data[Event.KnownDataKeys.Version] = value; return; } if (_checkedForVersion) return; _checkedForVersion = true; string version = null; try { version = GetVersionFromLoadedAssemblies(); } catch (Exception) {} if (String.IsNullOrEmpty(version)) return; context.Event.Data[Event.KnownDataKeys.Version] = context.Client.Configuration.DefaultData[Event.KnownDataKeys.Version] = version; }
/// <summary> /// Submits the event to be sent to the server. /// </summary> /// <param name="ev">The event data.</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> public void SubmitEvent(Event ev, ContextData pluginContextData = null) { if (ev == null) throw new ArgumentNullException("ev"); if (!Configuration.Enabled) { _log.Value.Info(typeof(ExceptionlessClient), "Configuration is disabled. The event will not be submitted."); return; } if (!Configuration.IsValid) { _log.Value.FormattedInfo(typeof(ExceptionlessClient), "Configuration is invalid: {0}. The event will not be submitted.", String.Join(", ", Configuration.Validate().Messages)); return; } if (!Configuration.IsLocked) { Configuration.LockConfig(); if (!Configuration.IsValid) { _log.Value.FormattedError(typeof(ExceptionlessClient), "Disabling client due to invalid configuration: {0}", String.Join(", ", Configuration.Validate().Messages)); return; } } var context = new EventPluginContext(this, ev, pluginContextData); EventPluginManager.Run(context); if (context.Cancel) return; // ensure all required data if (String.IsNullOrEmpty(ev.Type)) ev.Type = Event.KnownTypes.Log; if (ev.Date == DateTimeOffset.MinValue) ev.Date = DateTimeOffset.Now; if (!OnSubmittingEvent(ev, pluginContextData)) { _log.Value.FormattedInfo(typeof(ExceptionlessClient), "Event submission cancelled by event handler: id={0} type={1}", ev.ReferenceId, ev.Type); return; } _log.Value.FormattedTrace(typeof(ExceptionlessClient), "Submitting event: type={0}{1}", ev.Type, !String.IsNullOrEmpty(ev.ReferenceId) ? " refid=" + ev.ReferenceId : String.Empty); _queue.Value.Enqueue(ev); if (String.IsNullOrEmpty(ev.ReferenceId)) return; _log.Value.FormattedTrace(typeof(ExceptionlessClient), "Setting last reference id '{0}'", ev.ReferenceId); _lastReferenceIdManager.Value.SetLast(ev.ReferenceId); }
public void HandleAggregateExceptionsPlugin_SingleInnerException() { var client = new ExceptionlessClient(); var plugin = new HandleAggregateExceptionsPlugin(); var exceptionOne = new Exception("one"); var exceptionTwo = new Exception("two"); var context = new EventPluginContext(client, new Event()); context.ContextData.SetException(exceptionOne); plugin.Run(context); Assert.False(context.Cancel); context = new EventPluginContext(client, new Event()); context.ContextData.SetException(new AggregateException(exceptionOne)); plugin.Run(context); Assert.False(context.Cancel); Assert.Equal(exceptionOne, context.ContextData.GetException()); context = new EventPluginContext(client, new Event()); context.ContextData.SetException(new AggregateException(exceptionOne, exceptionTwo)); plugin.Run(context); Assert.False(context.Cancel); Assert.Equal(exceptionOne, context.ContextData.GetException()); }