message: Search dotnet pack folder for libnethost.
diff: #include "sdk/coreclr_delegates.h"
  #include "sdk/hostfxr.h"
  +#include <dirent.h>
  #include <dlfcn.h>
  #include <limits.h>
  @@ -61,15 +62,7 @@ bool DotNET::InitThunks()
  const char *paths[] = {
  "libnethost.so",
  "./libnethost.so",
  - "lib/libnethost.so",
  - "/usr/share/dotnet/packs/Microsoft.NETCore.App.Host.linux-x64/3.1.4/runtimes/linux-x64/native/libnethost.so",
  - "/usr/share/dotnet/packs/Microsoft.NETCore.App.Host.linux-x64/3.1.3/runtimes/linux-x64/native/libnethost.so",
  - "/usr/share/dotnet/packs/Microsoft.NETCore.App.Host.linux-x64/3.1.2/runtimes/linux-x64/native/libnethost.so",
  - "/usr/share/dotnet/packs/Microsoft.NETCore.App.Host.linux-x64/3.1.1/runtimes/linux-x64/native/libnethost.so",
  - "/usr/share/dotnet/packs/Microsoft.NETCore.App.Host.linux-x64/3.1.0/runtimes/linux-x64/native/libnethost.so",
  - "/usr/share/dotnet/packs/Microsoft.NETCore.App.Host.linux-x64/3.0.2/runtimes/linux-x64/native/libnethost.so",
  - "/usr/share/dotnet/packs/Microsoft.NETCore.App.Host.linux-x64/3.0.1/runtimes/linux-x64/native/libnethost.so",
  - "/usr/share/dotnet/packs/Microsoft.NETCore.App.Host.linux-x64/3.0.0/runtimes/linux-x64/native/libnethost.so"
  + "lib/libnethost.so"
  };
  for (size_t i = 0; i < std::size(paths); i++)
  {
  @@ -82,6 +75,38 @@ bool DotNET::InitThunks()
  }
  }
  + if (!nethost)
  + {
  + const auto hostBaseDir = "/usr/share/dotnet/packs/Microsoft.NETCore.App.Host.linux-x64/";
  + const auto hostLibSuffix = "/runtimes/linux-x64/native/libnethost.so";
  +
  + DIR* dir = opendir(hostBaseDir);
  +
  + if (dir != nullptr)
  + {
  + dirent* directoryEntry = readdir(dir);
  +
  + while (directoryEntry != nullptr)
  + {
  + if (directoryEntry->d_type == DT_DIR)
  + {
  + const auto path = (std::string(hostBaseDir) + directoryEntry->d_name + hostLibSuffix);
  +
  + nethost = dlopen(path.c_str(), RTLD_LAZY);
  + if (nethost)
  + {
  + LOG_INFO("Loaded libnethost.so from: %s (autodetected)", path);
  + break;
  + }
  + }
  +
  + directoryEntry = readdir(dir);
  + }
  +
  + closedir(dir);
  + }
  + }
  +
  if (!nethost)
  {
  LOG_ERROR("Unable to load libnethost.so. .NET plugin will be unavailable.");
  