From 8fec4baf9ddcc2eb060565f857916efc45097950 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Wed, 13 Apr 2022 23:42:12 +0700 Subject: [PATCH] Fix LeaseProvider instance Activator exception handling (#5838) --- src/core/Akka.Coordination/LeaseProvider.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/core/Akka.Coordination/LeaseProvider.cs b/src/core/Akka.Coordination/LeaseProvider.cs index 5f3df3b0fb1..0aeb012b1d8 100644 --- a/src/core/Akka.Coordination/LeaseProvider.cs +++ b/src/core/Akka.Coordination/LeaseProvider.cs @@ -141,12 +141,12 @@ public Lease GetLease(string leaseName, string configPath, string ownerName) { return (Lease)Activator.CreateInstance(leaseType, settings, _system); } - catch + catch(MissingMethodException) { return (Lease)Activator.CreateInstance(leaseType, settings); } } - catch (Exception ex) + catch (MissingMethodException ex) { Log.Error( ex, @@ -159,6 +159,17 @@ public Lease GetLease(string leaseName, string configPath, string ownerName) throw; } + catch(Exception ex) + { + Log.Error( + ex, + "Failed to instantiate lease class [{2}] for leaseName [{0}], configPath [{1}].", + settings.LeaseName, + configPath, + leaseType); + + throw; + } }); } }