dotnet/runtime

Better error message when not loading native shared library

Open

#11.891 aberto em 25 de jan. de 2019

Ver no GitHub
 (4 comments) (4 reactions) (0 assignees)C# (5.445 forks)batch import
area-Interop-coreclrhelp wanted

Métricas do repositório

Stars
 (17.886 stars)
Métricas de merge de PR
 (Mesclagem média 12d 11h) (661 fundiu PRs em 30d)

Description

Assembly loading problems are frustrating to debug, especially in some cloud world where you don't necessarily have control over regestry settings or env variables in the running environment.

Any error message containing "or" should be banned, but lets start with this one.

The expected error message should be "Failed to load DLL %1, couldn't find it. Searched for it in the following locations: %2" or "Failed to load DLL %1. Couldn't find its dependency %2 which comes from %3 dependency chain. Searched for %2 in the following locations: %4"

I understand that assembly loading needs to be fast, but this extra "give the user some information that can be used" doesn't have to kick into action before after the assembly have failed to load. And by that time I guess most programs doesn't have much meaningfull activity to spend their CPU on anyway.

Bonus: See how the Win version is much doesn't tell you how to get diagnostics (fusion logs should probably be recommended?)

IDS_EE_NDIRECT_LOADLIB_WIN              "Unable to load DLL '%1' or one of its dependencies: %2"
IDS_EE_NDIRECT_LOADLIB_LINUX            "Unable to load shared library '%1' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: %2"
IDS_EE_NDIRECT_LOADLIB_MAC              "Unable to load shared library '%1' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: %2"

Guia do colaborador