From dc5c88d438c1fde0f8e256863bfc9c4f303c8666 Mon Sep 17 00:00:00 2001 From: Jordan-Osborn <112627756+Jordan-Osborn@users.noreply.github.com> Date: Wed, 28 Aug 2024 15:10:24 +0100 Subject: [PATCH] Fix memory leak caused by not detaching event handler (#391) --- RabbitMQ.Stream.Client/Client.cs | 6 ------ RabbitMQ.Stream.Client/PublicAPI.Shipped.txt | 2 -- 2 files changed, 8 deletions(-) diff --git a/RabbitMQ.Stream.Client/Client.cs b/RabbitMQ.Stream.Client/Client.cs index 019bc979..f116c581 100644 --- a/RabbitMQ.Stream.Client/Client.cs +++ b/RabbitMQ.Stream.Client/Client.cs @@ -59,7 +59,6 @@ public record ClientParameters public delegate Task MetadataUpdateHandler(MetaDataUpdate update); public event MetadataUpdateHandler OnMetadataUpdate; - public Action UnhandledExceptionHandler { get; set; } = _ => { }; public TimeSpan Heartbeat { get; set; } = TimeSpan.FromMinutes(1); public string ClientProvidedName @@ -164,11 +163,6 @@ private Client(ClientParameters parameters, ILogger logger = null) IsClosed = false; _logger = logger ?? NullLogger.Instance; ClientId = Guid.NewGuid().ToString(); - AppDomain.CurrentDomain.UnhandledException += (sender, args) => - { - _logger.LogError(args.ExceptionObject as Exception, "Unhandled exception"); - Parameters.UnhandledExceptionHandler(args.ExceptionObject as Exception); - }; } public bool IsClosed diff --git a/RabbitMQ.Stream.Client/PublicAPI.Shipped.txt b/RabbitMQ.Stream.Client/PublicAPI.Shipped.txt index 69e44e3d..c640b9c7 100644 --- a/RabbitMQ.Stream.Client/PublicAPI.Shipped.txt +++ b/RabbitMQ.Stream.Client/PublicAPI.Shipped.txt @@ -200,8 +200,6 @@ RabbitMQ.Stream.Client.ClientParameters.Password.set -> void RabbitMQ.Stream.Client.ClientParameters.Properties.get -> System.Collections.Generic.IDictionary RabbitMQ.Stream.Client.ClientParameters.Ssl.get -> RabbitMQ.Stream.Client.SslOption RabbitMQ.Stream.Client.ClientParameters.Ssl.set -> void -RabbitMQ.Stream.Client.ClientParameters.UnhandledExceptionHandler.get -> System.Action -RabbitMQ.Stream.Client.ClientParameters.UnhandledExceptionHandler.set -> void RabbitMQ.Stream.Client.ClientParameters.UserName.get -> string RabbitMQ.Stream.Client.ClientParameters.UserName.set -> void RabbitMQ.Stream.Client.ClientParameters.VirtualHost.get -> string