File tree Expand file tree Collapse file tree
source/icu.net/NativeMethods Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -347,14 +347,16 @@ private static IntPtr GetIcuLibHandle(string basename, int icuVersion)
347347 var libPath = string . IsNullOrEmpty ( _IcuPath ) ? libName : Path . Combine ( _IcuPath , libName ) ;
348348
349349#if NET6_0_OR_GREATER
350+ string exceptionErrorMessage = null ;
350351 loadMethod = "NativeLibrary.Load" ;
351352 try
352353 {
353354 handle = NativeLibrary . Load ( libPath ) ;
354355 }
355- catch ( DllNotFoundException )
356+ catch ( DllNotFoundException ex )
356357 {
357358 handle = IntPtr . Zero ;
359+ exceptionErrorMessage = ex . Message ;
358360 }
359361#else
360362 if ( IsWindows )
@@ -385,14 +387,16 @@ private static IntPtr GetIcuLibHandle(string basename, int icuVersion)
385387
386388 lastError = Marshal . GetLastWin32Error ( ) ;
387389#if NET6_0_OR_GREATER
390+ if ( ! string . IsNullOrEmpty ( exceptionErrorMessage ) )
391+ exceptionErrorMessage = $ " ({ exceptionErrorMessage } )";
388392 var errorMsg = IsWindows
389- ? new Win32Exception ( lastError ) . Message
390- : $ "{ lastError } ";
393+ ? $ " { new Win32Exception ( lastError ) . Message } { exceptionErrorMessage } "
394+ : $ "{ lastError } ( { exceptionErrorMessage } ) ";
391395#else
392396 var errorMsg = IsWindows
393397 ? new Win32Exception ( lastError ) . Message
394398 : IsMac
395- ? $ "{ lastError } "
399+ ? $ "{ lastError } (macOS loading requires .NET 6 or greater) "
396400 : $ "{ lastError } ({ dlerror ( ) } )";
397401#endif
398402 Trace . WriteLineIf ( lastError != 0 , $ "Unable to load [{ libPath } ]. Error: { errorMsg } ") ;
You can’t perform that action at this time.
0 commit comments