Throw better error when libuv can't be loaded

- Throw more specific exception for *nix machines
This commit is contained in:
David Fowler 2014-12-26 14:37:37 -08:00
parent d08e5d3572
commit e421b3f01c
1 changed files with 14 additions and 0 deletions

View File

@ -31,6 +31,20 @@ namespace Microsoft.AspNet.Server.Kestrel.Networking
PlatformApis.Apply(this);
var module = LoadLibrary(dllToLoad);
if (module == IntPtr.Zero)
{
var message = "Unable to load libuv.";
if (!IsWindows && !IsDarwin)
{
// *nix box, so libuv needs to be installed
// TODO: fwlink?
message += " Make sure libuv is installed and available as libuv.so.1";
}
throw new InvalidOperationException(message);
}
foreach (var field in GetType().GetTypeInfo().DeclaredFields)
{
var procAddress = GetProcAddress(module, field.Name.TrimStart('_'));