Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

Commit e421b3f

Browse files
committed
Throw better error when libuv can't be loaded
- Throw more specific exception for *nix machines
1 parent d08e5d3 commit e421b3f

File tree

1 file changed

+14
-0
lines changed
  • src/Microsoft.AspNet.Server.Kestrel/Networking

1 file changed

+14
-0
lines changed

src/Microsoft.AspNet.Server.Kestrel/Networking/Libuv.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,20 @@ public void Load(string dllToLoad)
3131
PlatformApis.Apply(this);
3232

3333
var module = LoadLibrary(dllToLoad);
34+
35+
if (module == IntPtr.Zero)
36+
{
37+
var message = "Unable to load libuv.";
38+
if (!IsWindows && !IsDarwin)
39+
{
40+
// *nix box, so libuv needs to be installed
41+
// TODO: fwlink?
42+
message += " Make sure libuv is installed and available as libuv.so.1";
43+
}
44+
45+
throw new InvalidOperationException(message);
46+
}
47+
3448
foreach (var field in GetType().GetTypeInfo().DeclaredFields)
3549
{
3650
var procAddress = GetProcAddress(module, field.Name.TrimStart('_'));

0 commit comments

Comments
 (0)