@@ -297,6 +297,7 @@ public IEnumerable<PluginRegistration> Plugins {
297
297
/// <param name="plugin">The plugin instance to be added.</param>
298
298
public void AddPlugin < T > ( T plugin ) where T : IEventPlugin {
299
299
string key = typeof ( T ) . FullName ;
300
+ RemovePlugin ( key ) ;
300
301
_plugins [ key ] = new PluginRegistration ( key , GetPriority ( typeof ( T ) ) , new Lazy < IEventPlugin > ( ( ) => plugin ) ) ;
301
302
}
302
303
@@ -314,6 +315,7 @@ public void AddPlugin<T>() where T : IEventPlugin {
314
315
/// <param name="key">The key used to identify the plugin.</param>
315
316
/// <param name="pluginType">The plugin type to be added.</param>
316
317
public void AddPlugin ( string key , Type pluginType ) {
318
+ RemovePlugin ( key ) ;
317
319
_plugins [ key ] = new PluginRegistration ( key , GetPriority ( pluginType ) , new Lazy < IEventPlugin > ( ( ) => Resolver . Resolve ( pluginType ) as IEventPlugin ) ) ;
318
320
}
319
321
@@ -333,6 +335,7 @@ public void AddPlugin(string key, Func<ExceptionlessConfiguration, IEventPlugin>
333
335
/// <param name="priority">Used to determine plugins priority.</param>
334
336
/// <param name="factory">A factory method to create the plugin.</param>
335
337
public void AddPlugin ( string key , int priority , Func < ExceptionlessConfiguration , IEventPlugin > factory ) {
338
+ RemovePlugin ( key ) ;
336
339
_plugins [ key ] = new PluginRegistration ( key , priority , new Lazy < IEventPlugin > ( ( ) => factory ( this ) ) ) ;
337
340
}
338
341
@@ -360,6 +363,7 @@ public void AddPlugin(string key, Action<EventPluginContext> pluginAction) {
360
363
/// <param name="priority">Used to determine plugins priority.</param>
361
364
/// <param name="pluginAction">The plugin action to run.</param>
362
365
public void AddPlugin ( string key , int priority , Action < EventPluginContext > pluginAction ) {
366
+ RemovePlugin ( key ) ;
363
367
_plugins [ key ] = new PluginRegistration ( key , priority , new Lazy < IEventPlugin > ( ( ) => new ActionPlugin ( pluginAction ) ) ) ;
364
368
}
365
369
0 commit comments