Skip to content

Commit 89bfc9a

Browse files
committed
Handling pre-2.5 images.
1 parent 0811406 commit 89bfc9a

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

Provider/src/FirebirdSql.Data.FirebirdClient/Client/Native/FbClientFactory.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public static IFbClient Create(string dllName)
7777
var result = cache.GetOrAdd(dllName, s => { createdNew = true; return BuildFbClient(s); });
7878
if (createdNew)
7979
{
80-
ShutdownHelper.RegisterFbClientShutdown(() => result.fb_shutdown(0, 0));
80+
ShutdownHelper.RegisterFbClientShutdown(() => ShutdownEntryPointWrapper(result));
8181
}
8282
return result;
8383
}
@@ -305,5 +305,22 @@ private static string SanitizeBaseName(string baseName)
305305

306306
return "FB_" + Math.Abs(baseName.GetHashCode());
307307
}
308+
309+
private static void ShutdownEntryPointWrapper(IFbClient fbClient)
310+
{
311+
// the fb_shutdown does not exists before 2.5
312+
// the exception is just ignored
313+
// once <2.5 is not existing we can remove this
314+
try
315+
{
316+
fbClient.fb_shutdown(0, 0);
317+
}
318+
#if NETSTANDARD1_6
319+
catch (Exception ex) when (ex.GetType().Name == "EntryPointNotFoundException")
320+
#else
321+
catch (EntryPointNotFoundException)
322+
#endif
323+
{ }
324+
}
308325
}
309326
}

0 commit comments

Comments
 (0)