This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix GetAddrInfoExSupportsOverlapped UAP build break
`System.Net.NameResolutionPal.GetAddrInfoExSupportsOverlapped` uses LoadLibraryExW which is not compatible with UAP (which only supports LoadLibrary of DLLs within a container). Refactor the helper so UAP returns false.
- Loading branch information
Showing
4 changed files
with
44 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/System.Net.NameResolution/src/System/Net/NameResolutionPal.Windows.NetCoreApp.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using Microsoft.Win32.SafeHandles; | ||
|
||
namespace System.Net | ||
{ | ||
internal static partial class NameResolutionPal | ||
{ | ||
|
||
This comment has been minimized.
Sorry, something went wrong. |
||
private static bool GetAddrInfoExSupportsOverlapped() | ||
{ | ||
using (SafeLibraryHandle libHandle = Interop.Kernel32.LoadLibraryExW(Interop.Libraries.Ws2_32, IntPtr.Zero, Interop.Kernel32.LOAD_LIBRARY_SEARCH_SYSTEM32)) | ||
{ | ||
if (libHandle.IsInvalid) | ||
return false; | ||
|
||
// We can't just check that 'GetAddrInfoEx' exists, because it existed before supporting overlapped. | ||
// The existance of 'GetAddrInfoExCancel' indicates that overlapped is supported. | ||
return Interop.Kernel32.GetProcAddress(libHandle, Interop.Winsock.GetAddrInfoExCancelFunctionName) != IntPtr.Zero; | ||
} | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/System.Net.NameResolution/src/System/Net/NameResolutionPal.Windows.Uap.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
namespace System.Net | ||
{ | ||
internal static partial class NameResolutionPal | ||
{ | ||
|
||
This comment has been minimized.
Sorry, something went wrong. |
||
private static bool GetAddrInfoExSupportsOverlapped() | ||
{ | ||
return false; | ||
} | ||
This comment has been minimized.
Sorry, something went wrong.
stephentoub
Member
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 comment
on commit f3a86db
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
Nit: unnecessary blank line