Transition to netstandard.

- dotnet5.X => netstandard1.y (where y = x-1).
- DNXCore50 => netstandardapp1.5.
- Applied the same changes to ifdefs.
This commit is contained in:
N. Taylor Mullen 2016-03-01 13:35:50 -08:00
parent eafda23e80
commit 5433130182
42 changed files with 117 additions and 85 deletions

View File

@ -9,14 +9,17 @@
}, },
"frameworks": { "frameworks": {
"dnx451": {}, "dnx451": {},
"dnxcore50": { "netstandardapp1.5": {
"dependencies": { "dependencies": {
"System.Collections": "4.0.11-*", "System.Collections": "4.0.11-*",
"System.Console": "4.0.0-*", "System.Console": "4.0.0-*",
"System.Globalization": "4.0.11-*", "System.Globalization": "4.0.11-*",
"System.IO": "4.1.0-*", "System.IO": "4.1.0-*",
"System.Threading.Tasks": "4.0.11-*" "System.Threading.Tasks": "4.0.11-*"
} },
"imports": [
"dnxcore50"
]
} }
} }
} }

View File

@ -13,6 +13,10 @@
}, },
"frameworks": { "frameworks": {
"dnx451": {}, "dnx451": {},
"dnxcore50": {} "netstandardapp1.5": {
"imports": [
"dnxcore50"
]
}
} }
} }

View File

@ -12,6 +12,10 @@
}, },
"frameworks": { "frameworks": {
"dnx451": {}, "dnx451": {},
"dnxcore50": {} "netstandardapp1.5": {
"imports": [
"dnxcore50"
]
}
} }
} }

View File

@ -10,16 +10,21 @@
"allowUnsafe": true, "allowUnsafe": true,
"warningsAsErrors": true, "warningsAsErrors": true,
"keyFile": "../../tools/Key.snk", "keyFile": "../../tools/Key.snk",
"nowarn": [ "CS1591" ], "nowarn": [
"CS1591"
],
"xmlDoc": true "xmlDoc": true
}, },
"frameworks": { "frameworks": {
"net451": {}, "net451": {},
"dotnet5.4": { "netstandard1.3": {
"dependencies": { "dependencies": {
"System.Security.Claims": "4.0.1-*" "System.Security.Claims": "4.0.1-*"
}, },
"imports": "portable-net451+win8" "imports": [
"dotnet5.4",
"portable-net451+win8"
]
} }
} }
} }

View File

@ -32,7 +32,7 @@ namespace Microsoft.Net.Http.Server
static ComNetOS() static ComNetOS()
{ {
#if DOTNET5_4 #if NETSTANDARD1_3
// TODO: SkipIOCPCallbackOnSuccess doesn't work on Win7. Need a way to detect Win7 vs 8+. // TODO: SkipIOCPCallbackOnSuccess doesn't work on Win7. Need a way to detect Win7 vs 8+.
IsWin8orLater = false; IsWin8orLater = false;
#else #else

View File

@ -26,7 +26,7 @@ using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Security; using System.Security;
#if !DOTNET5_4 #if !NETSTANDARD1_3
using Microsoft.Win32; using Microsoft.Win32;
#endif #endif
@ -34,7 +34,7 @@ namespace Microsoft.Net.Http.Server
{ {
internal static class HttpSysSettings internal static class HttpSysSettings
{ {
#if !DOTNET5_4 #if !NETSTANDARD1_3
private const string HttpSysParametersKey = @"System\CurrentControlSet\Services\HTTP\Parameters"; private const string HttpSysParametersKey = @"System\CurrentControlSet\Services\HTTP\Parameters";
#endif #endif
private const bool EnableNonUtf8Default = true; private const bool EnableNonUtf8Default = true;
@ -61,7 +61,7 @@ namespace Microsoft.Net.Http.Server
} }
private static void ReadHttpSysRegistrySettings() private static void ReadHttpSysRegistrySettings()
#if DOTNET5_4 #if NETSTANDARD1_3
{ {
} }
#else #else

View File

@ -32,7 +32,7 @@ namespace Microsoft.Net.Http.Server
get get
{ {
return Environment.HasShutdownStarted return Environment.HasShutdownStarted
#if !DOTNET5_4 #if !NETSTANDARD1_3
|| AppDomain.CurrentDomain.IsFinalizingForUnload() || AppDomain.CurrentDomain.IsFinalizingForUnload()
#endif #endif
; ;

View File

@ -33,7 +33,7 @@ namespace Microsoft.Net.Http.Server
{ {
private const string HTTPAPI = "httpapi.dll"; private const string HTTPAPI = "httpapi.dll";
#if DOTNET5_4 #if NETSTANDARD1_3
private const string sspicli_LIB = "sspicli.dll"; private const string sspicli_LIB = "sspicli.dll";
private const string api_ms_win_core_processthreads_LIB = "api-ms-win-core-processthreads-l1-1-1.dll"; private const string api_ms_win_core_processthreads_LIB = "api-ms-win-core-processthreads-l1-1-1.dll";
private const string api_ms_win_core_io_LIB = "api-ms-win-core-io-l1-1-1.dll"; private const string api_ms_win_core_io_LIB = "api-ms-win-core-io-l1-1-1.dll";
@ -63,21 +63,21 @@ namespace Microsoft.Net.Http.Server
internal const uint ERROR_CONNECTION_INVALID = 1229; internal const uint ERROR_CONNECTION_INVALID = 1229;
} }
#if DOTNET5_4 #if NETSTANDARD1_3
[DllImport(api_ms_win_core_processthreads_LIB, ExactSpelling = true, CallingConvention = CallingConvention.StdCall, SetLastError = true)] [DllImport(api_ms_win_core_processthreads_LIB, ExactSpelling = true, CallingConvention = CallingConvention.StdCall, SetLastError = true)]
#else #else
[DllImport(KERNEL32, ExactSpelling = true, CallingConvention = CallingConvention.StdCall, SetLastError = true)] [DllImport(KERNEL32, ExactSpelling = true, CallingConvention = CallingConvention.StdCall, SetLastError = true)]
#endif #endif
internal static extern uint GetCurrentThreadId(); internal static extern uint GetCurrentThreadId();
#if DOTNET5_4 #if NETSTANDARD1_3
[DllImport(api_ms_win_core_io_LIB, ExactSpelling = true, CallingConvention = CallingConvention.StdCall, SetLastError = true)] [DllImport(api_ms_win_core_io_LIB, ExactSpelling = true, CallingConvention = CallingConvention.StdCall, SetLastError = true)]
#else #else
[DllImport(KERNEL32, ExactSpelling = true, CallingConvention = CallingConvention.StdCall, SetLastError = true)] [DllImport(KERNEL32, ExactSpelling = true, CallingConvention = CallingConvention.StdCall, SetLastError = true)]
#endif #endif
internal static unsafe extern uint CancelIoEx(SafeHandle handle, SafeNativeOverlapped overlapped); internal static unsafe extern uint CancelIoEx(SafeHandle handle, SafeNativeOverlapped overlapped);
#if DOTNET5_4 #if NETSTANDARD1_3
[DllImport(api_ms_win_core_kernel32_legacy_LIB, ExactSpelling = true, CallingConvention = CallingConvention.StdCall, SetLastError = true)] [DllImport(api_ms_win_core_kernel32_legacy_LIB, ExactSpelling = true, CallingConvention = CallingConvention.StdCall, SetLastError = true)]
#else #else
[DllImport(KERNEL32, ExactSpelling = true, CallingConvention = CallingConvention.StdCall, SetLastError = true)] [DllImport(KERNEL32, ExactSpelling = true, CallingConvention = CallingConvention.StdCall, SetLastError = true)]
@ -102,7 +102,7 @@ namespace Microsoft.Net.Http.Server
[Out] out HeapAllocHandle resultList); [Out] out HeapAllocHandle resultList);
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa366569(v=vs.85).aspx // http://msdn.microsoft.com/en-us/library/windows/desktop/aa366569(v=vs.85).aspx
#if DOTNET5_4 #if NETSTANDARD1_3
[DllImport(api_ms_win_core_heap_LIB, CallingConvention = CallingConvention.Winapi, SetLastError = true)] [DllImport(api_ms_win_core_heap_LIB, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
#else #else
[DllImport(KERNEL32, CallingConvention = CallingConvention.Winapi, SetLastError = true)] [DllImport(KERNEL32, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
@ -110,7 +110,7 @@ namespace Microsoft.Net.Http.Server
internal static extern IntPtr GetProcessHeap(); internal static extern IntPtr GetProcessHeap();
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa366701(v=vs.85).aspx // http://msdn.microsoft.com/en-us/library/windows/desktop/aa366701(v=vs.85).aspx
#if DOTNET5_4 #if NETSTANDARD1_3
[DllImport(api_ms_win_core_heap_LIB, CallingConvention = CallingConvention.Winapi, SetLastError = true)] [DllImport(api_ms_win_core_heap_LIB, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
#else #else
[DllImport(KERNEL32, CallingConvention = CallingConvention.Winapi, SetLastError = true)] [DllImport(KERNEL32, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
@ -122,7 +122,7 @@ namespace Microsoft.Net.Http.Server
internal static class SafeNetHandles internal static class SafeNetHandles
{ {
#if DOTNET5_4 #if NETSTANDARD1_3
[DllImport(sspicli_LIB, ExactSpelling = true, SetLastError = true)] [DllImport(sspicli_LIB, ExactSpelling = true, SetLastError = true)]
#else #else
[DllImport(SECUR32, ExactSpelling = true, SetLastError = true)] [DllImport(SECUR32, ExactSpelling = true, SetLastError = true)]
@ -130,7 +130,7 @@ namespace Microsoft.Net.Http.Server
internal static extern int FreeContextBuffer( internal static extern int FreeContextBuffer(
[In] IntPtr contextBuffer); [In] IntPtr contextBuffer);
#if DOTNET5_4 #if NETSTANDARD1_3
[DllImport(sspicli_LIB, ExactSpelling = true, SetLastError = true)] [DllImport(sspicli_LIB, ExactSpelling = true, SetLastError = true)]
#else #else
[DllImport(SECUR32, ExactSpelling = true, SetLastError = true)] [DllImport(SECUR32, ExactSpelling = true, SetLastError = true)]
@ -147,21 +147,21 @@ namespace Microsoft.Net.Http.Server
[DllImport(HTTPAPI, ExactSpelling = true, CallingConvention = CallingConvention.StdCall, SetLastError = true)] [DllImport(HTTPAPI, ExactSpelling = true, CallingConvention = CallingConvention.StdCall, SetLastError = true)]
internal static extern unsafe uint HttpCloseRequestQueue(IntPtr pReqQueueHandle); internal static extern unsafe uint HttpCloseRequestQueue(IntPtr pReqQueueHandle);
#if DOTNET5_4 #if NETSTANDARD1_3
[DllImport(api_ms_win_core_handle_LIB, ExactSpelling = true, SetLastError = true)] [DllImport(api_ms_win_core_handle_LIB, ExactSpelling = true, SetLastError = true)]
#else #else
[DllImport(KERNEL32, ExactSpelling = true, SetLastError = true)] [DllImport(KERNEL32, ExactSpelling = true, SetLastError = true)]
#endif #endif
internal static extern bool CloseHandle(IntPtr handle); internal static extern bool CloseHandle(IntPtr handle);
#if DOTNET5_4 #if NETSTANDARD1_3
[DllImport(api_ms_win_core_heap_obsolete_LIB, ExactSpelling = true, SetLastError = true)] [DllImport(api_ms_win_core_heap_obsolete_LIB, ExactSpelling = true, SetLastError = true)]
#else #else
[DllImport(KERNEL32, ExactSpelling = true, SetLastError = true)] [DllImport(KERNEL32, ExactSpelling = true, SetLastError = true)]
#endif #endif
internal static extern SafeLocalFree LocalAlloc(int uFlags, UIntPtr sizetdwBytes); internal static extern SafeLocalFree LocalAlloc(int uFlags, UIntPtr sizetdwBytes);
#if DOTNET5_4 #if NETSTANDARD1_3
[DllImport(api_ms_win_core_heap_obsolete_LIB, EntryPoint = "LocalAlloc", SetLastError = true)] [DllImport(api_ms_win_core_heap_obsolete_LIB, EntryPoint = "LocalAlloc", SetLastError = true)]
#else #else
[DllImport(KERNEL32, EntryPoint = "LocalAlloc", SetLastError = true)] [DllImport(KERNEL32, EntryPoint = "LocalAlloc", SetLastError = true)]
@ -169,21 +169,21 @@ namespace Microsoft.Net.Http.Server
internal static extern SafeLocalFreeChannelBinding LocalAllocChannelBinding(int uFlags, UIntPtr sizetdwBytes); internal static extern SafeLocalFreeChannelBinding LocalAllocChannelBinding(int uFlags, UIntPtr sizetdwBytes);
#if DOTNET5_4 #if NETSTANDARD1_3
[DllImport(api_ms_win_core_heap_obsolete_LIB, ExactSpelling = true, SetLastError = true)] [DllImport(api_ms_win_core_heap_obsolete_LIB, ExactSpelling = true, SetLastError = true)]
#else #else
[DllImport(KERNEL32, ExactSpelling = true, SetLastError = true)] [DllImport(KERNEL32, ExactSpelling = true, SetLastError = true)]
#endif #endif
internal static extern IntPtr LocalFree(IntPtr handle); internal static extern IntPtr LocalFree(IntPtr handle);
#if DOTNET5_4 #if NETSTANDARD1_3
[DllImport(api_ms_win_core_libraryloader_LIB, ExactSpelling = true, CharSet = CharSet.Unicode, SetLastError = true)] [DllImport(api_ms_win_core_libraryloader_LIB, ExactSpelling = true, CharSet = CharSet.Unicode, SetLastError = true)]
#else #else
[DllImport(KERNEL32, ExactSpelling = true, CharSet = CharSet.Unicode, SetLastError = true)] [DllImport(KERNEL32, ExactSpelling = true, CharSet = CharSet.Unicode, SetLastError = true)]
#endif #endif
internal static extern unsafe SafeLoadLibrary LoadLibraryExW([In] string lpwLibFileName, [In] void* hFile, [In] uint dwFlags); internal static extern unsafe SafeLoadLibrary LoadLibraryExW([In] string lpwLibFileName, [In] void* hFile, [In] uint dwFlags);
#if DOTNET5_4 #if NETSTANDARD1_3
[DllImport(api_ms_win_core_libraryloader_LIB, ExactSpelling = true, SetLastError = true)] [DllImport(api_ms_win_core_libraryloader_LIB, ExactSpelling = true, SetLastError = true)]
#else #else
[DllImport(KERNEL32, ExactSpelling = true, SetLastError = true)] [DllImport(KERNEL32, ExactSpelling = true, SetLastError = true)]

View File

@ -1,4 +1,4 @@
#if !DOTNET5_4 // TODO: Temp copy. Remove once we target net46. #if !NETSTANDARD1_3 // TODO: Temp copy. Remove once we target net46.
using System; using System;
namespace System.Threading namespace System.Threading
{ {

View File

@ -1,4 +1,4 @@
#if !DOTNET5_4 // TODO: Temp copy. Remove once we target net46. #if !NETSTANDARD1_3 // TODO: Temp copy. Remove once we target net46.
using System; using System;
namespace System.Threading namespace System.Threading
{ {

View File

@ -1,4 +1,4 @@
#if !DOTNET5_4 // TODO: Temp copy. Remove once we target net46. #if !NETSTANDARD1_3 // TODO: Temp copy. Remove once we target net46.
using System; using System;
namespace System.Threading namespace System.Threading
{ {

View File

@ -1,4 +1,4 @@
#if !DOTNET5_4 // TODO: Temp copy. Remove once we target net46. #if !NETSTANDARD1_3 // TODO: Temp copy. Remove once we target net46.
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace System.Threading namespace System.Threading

View File

@ -1,4 +1,4 @@
#if !DOTNET5_4 // TODO: Temp copy. Remove once we target net46. #if !NETSTANDARD1_3 // TODO: Temp copy. Remove once we target net46.
using System; using System;
namespace System.Threading namespace System.Threading
{ {

View File

@ -109,7 +109,7 @@ namespace Microsoft.Net.Http.Server
{ {
return _requestStream.ReadByte(); return _requestStream.ReadByte();
} }
#if !DOTNET5_4 #if !NETSTANDARD1_3
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state) public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
{ {
return _requestStream.BeginRead(buffer, offset, count, callback, state); return _requestStream.BeginRead(buffer, offset, count, callback, state);
@ -143,7 +143,7 @@ namespace Microsoft.Net.Http.Server
{ {
_responseStream.WriteByte(value); _responseStream.WriteByte(value);
} }
#if !DOTNET5_4 #if !NETSTANDARD1_3
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state) public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
{ {
return _responseStream.BeginWrite(buffer, offset, count, callback, state); return _responseStream.BeginWrite(buffer, offset, count, callback, state);

View File

@ -203,7 +203,7 @@ namespace Microsoft.Net.Http.Server
} }
} }
#if DOTNET5_4 #if NETSTANDARD1_3
public unsafe IAsyncResult BeginRead(byte[] buffer, int offset, int size, AsyncCallback callback, object state) public unsafe IAsyncResult BeginRead(byte[] buffer, int offset, int size, AsyncCallback callback, object state)
#else #else
public override unsafe IAsyncResult BeginRead(byte[] buffer, int offset, int size, AsyncCallback callback, object state) public override unsafe IAsyncResult BeginRead(byte[] buffer, int offset, int size, AsyncCallback callback, object state)
@ -293,7 +293,7 @@ namespace Microsoft.Net.Http.Server
return asyncResult; return asyncResult;
} }
#if DOTNET5_4 #if NETSTANDARD1_3
public int EndRead(IAsyncResult asyncResult) public int EndRead(IAsyncResult asyncResult)
#else #else
public override int EndRead(IAsyncResult asyncResult) public override int EndRead(IAsyncResult asyncResult)
@ -428,7 +428,7 @@ namespace Microsoft.Net.Http.Server
throw new InvalidOperationException(Resources.Exception_ReadOnlyStream); throw new InvalidOperationException(Resources.Exception_ReadOnlyStream);
} }
#if DOTNET5_4 #if NETSTANDARD1_3
public IAsyncResult BeginWrite(byte[] buffer, int offset, int size, AsyncCallback callback, object state) public IAsyncResult BeginWrite(byte[] buffer, int offset, int size, AsyncCallback callback, object state)
#else #else
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int size, AsyncCallback callback, object state) public override IAsyncResult BeginWrite(byte[] buffer, int offset, int size, AsyncCallback callback, object state)
@ -437,7 +437,7 @@ namespace Microsoft.Net.Http.Server
throw new InvalidOperationException(Resources.Exception_ReadOnlyStream); throw new InvalidOperationException(Resources.Exception_ReadOnlyStream);
} }
#if DOTNET5_4 #if NETSTANDARD1_3
public void EndWrite(IAsyncResult asyncResult) public void EndWrite(IAsyncResult asyncResult)
#else #else
public override void EndWrite(IAsyncResult asyncResult) public override void EndWrite(IAsyncResult asyncResult)

View File

@ -379,7 +379,7 @@ namespace Microsoft.Net.Http.Server
throw new InvalidOperationException(Resources.Exception_WriteOnlyStream); throw new InvalidOperationException(Resources.Exception_WriteOnlyStream);
} }
#if !DOTNET5_4 #if !NETSTANDARD1_3
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state) public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
{ {
throw new InvalidOperationException(Resources.Exception_WriteOnlyStream); throw new InvalidOperationException(Resources.Exception_WriteOnlyStream);
@ -468,7 +468,7 @@ namespace Microsoft.Net.Http.Server
} }
} }
#if DOTNET5_4 #if NETSTANDARD1_3
public unsafe IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state) public unsafe IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
#else #else
public override unsafe IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state) public override unsafe IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
@ -476,7 +476,7 @@ namespace Microsoft.Net.Http.Server
{ {
return WriteAsync(buffer, offset, count).ToIAsyncResult(callback, state); return WriteAsync(buffer, offset, count).ToIAsyncResult(callback, state);
} }
#if DOTNET5_4 #if NETSTANDARD1_3
public void EndWrite(IAsyncResult asyncResult) public void EndWrite(IAsyncResult asyncResult)
#else #else
public override void EndWrite(IAsyncResult asyncResult) public override void EndWrite(IAsyncResult asyncResult)

View File

@ -120,7 +120,7 @@ namespace Microsoft.Net.Http.Server
var boundHandle = responseStream.RequestContext.Server.BoundHandle; var boundHandle = responseStream.RequestContext.Server.BoundHandle;
int bufferSize = 1024 * 64; // TODO: Validate buffer size choice. int bufferSize = 1024 * 64; // TODO: Validate buffer size choice.
#if DOTNET5_4 #if NETSTANDARD1_3
_fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, bufferSize /*, useAsync: true*/); // Extremely expensive. _fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, bufferSize /*, useAsync: true*/); // Extremely expensive.
#else #else
// It's too expensive to validate anything before opening the file. Open the file and then check the lengths. // It's too expensive to validate anything before opening the file. Open the file and then check the lengths.

View File

@ -45,7 +45,7 @@ namespace Microsoft.Net.Http.Server
: base(errorCode, message) : base(errorCode, message)
{ {
} }
#if DOTNET5_4 #if NETSTANDARD1_3
public int ErrorCode public int ErrorCode
#else #else
// the base class returns the HResult with this property // the base class returns the HResult with this property

View File

@ -21,7 +21,7 @@
// //
// ==--== // ==--==
#if DOTNET5_4 #if NETSTANDARD1_3
namespace Microsoft.Win32.SafeHandles namespace Microsoft.Win32.SafeHandles
{ {

View File

@ -21,7 +21,7 @@
// //
// ==--== // ==--==
#if DOTNET5_4 #if NETSTANDARD1_3
namespace Microsoft.Win32.SafeHandles namespace Microsoft.Win32.SafeHandles
{ {

View File

@ -21,7 +21,7 @@
// </copyright> // </copyright>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#if DOTNET5_4 #if NETSTANDARD1_3
using System; using System;
using System.ComponentModel; using System.ComponentModel;

View File

@ -21,7 +21,7 @@
// </copyright> // </copyright>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#if DOTNET5_4 #if NETSTANDARD1_3
namespace System namespace System
{ {

View File

@ -31,7 +31,7 @@
** **
=============================================================================*/ =============================================================================*/
#if DOTNET5_4 #if NETSTANDARD1_3
namespace System.Runtime.InteropServices namespace System.Runtime.InteropServices
{ {

View File

@ -21,7 +21,7 @@
// </copyright> // </copyright>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#if DOTNET5_4 #if NETSTANDARD1_3
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;

View File

@ -9,12 +9,14 @@
"allowUnsafe": true, "allowUnsafe": true,
"warningsAsErrors": true, "warningsAsErrors": true,
"keyFile": "../../tools/Key.snk", "keyFile": "../../tools/Key.snk",
"nowarn": [ "CS1591" ], "nowarn": [
"CS1591"
],
"xmlDoc": true "xmlDoc": true
}, },
"frameworks": { "frameworks": {
"net451": {}, "net451": {},
"dotnet5.4": { "netstandard1.3": {
"dependencies": { "dependencies": {
"Microsoft.Win32.Primitives": "4.0.1-*", "Microsoft.Win32.Primitives": "4.0.1-*",
"System.Diagnostics.Contracts": "4.0.1-*", "System.Diagnostics.Contracts": "4.0.1-*",
@ -29,7 +31,10 @@
"System.Security.Principal.Windows": "4.0.0-*", "System.Security.Principal.Windows": "4.0.0-*",
"System.Text.Encoding.Extensions": "4.0.11-*", "System.Text.Encoding.Extensions": "4.0.11-*",
"System.Threading.Overlapped": "4.0.1-*" "System.Threading.Overlapped": "4.0.1-*"
} },
"imports": [
"dotnet5.4"
]
} }
} }
} }

View File

@ -31,7 +31,7 @@ namespace Microsoft.Net.WebSockets
{ {
internal static class UnsafeNativeMethods internal static class UnsafeNativeMethods
{ {
#if DOTNET5_4 #if NETSTANDARD1_3
private const string api_ms_win_core_libraryloader_LIB = "api-ms-win-core-libraryloader-l1-1-0.dll"; private const string api_ms_win_core_libraryloader_LIB = "api-ms-win-core-libraryloader-l1-1-0.dll";
#else #else
private const string KERNEL32 = "kernel32.dll"; private const string KERNEL32 = "kernel32.dll";
@ -40,14 +40,14 @@ namespace Microsoft.Net.WebSockets
internal static class SafeNetHandles internal static class SafeNetHandles
{ {
#if DOTNET5_4 #if NETSTANDARD1_3
[DllImport(api_ms_win_core_libraryloader_LIB, ExactSpelling = true, CharSet = CharSet.Unicode, SetLastError = true)] [DllImport(api_ms_win_core_libraryloader_LIB, ExactSpelling = true, CharSet = CharSet.Unicode, SetLastError = true)]
#else #else
[DllImport(KERNEL32, ExactSpelling = true, CharSet=CharSet.Unicode, SetLastError = true)] [DllImport(KERNEL32, ExactSpelling = true, CharSet=CharSet.Unicode, SetLastError = true)]
#endif #endif
internal static extern unsafe SafeLoadLibrary LoadLibraryExW([In] string lpwLibFileName, [In] void* hFile, [In] uint dwFlags); internal static extern unsafe SafeLoadLibrary LoadLibraryExW([In] string lpwLibFileName, [In] void* hFile, [In] uint dwFlags);
#if DOTNET5_4 #if NETSTANDARD1_3
[DllImport(api_ms_win_core_libraryloader_LIB, ExactSpelling = true, SetLastError = true)] [DllImport(api_ms_win_core_libraryloader_LIB, ExactSpelling = true, SetLastError = true)]
#else #else
[DllImport(KERNEL32, ExactSpelling = true, SetLastError = true)] [DllImport(KERNEL32, ExactSpelling = true, SetLastError = true)]
@ -173,7 +173,7 @@ namespace Microsoft.Net.WebSockets
static WebSocketProtocolComponent() static WebSocketProtocolComponent()
{ {
#if DOTNET5_4 #if NETSTANDARD1_3
DllFileName = Path.Combine(Environment.GetEnvironmentVariable("SYSTEMROOT"), "System32", WEBSOCKET); DllFileName = Path.Combine(Environment.GetEnvironmentVariable("SYSTEMROOT"), "System32", WEBSOCKET);
#else #else
DllFileName = Path.Combine(Environment.SystemDirectory, WEBSOCKET); DllFileName = Path.Combine(Environment.SystemDirectory, WEBSOCKET);

View File

@ -1103,7 +1103,7 @@ namespace Microsoft.Net.WebSockets
if (thisLockTaken || sessionHandleLockTaken) if (thisLockTaken || sessionHandleLockTaken)
{ {
#if !DOTNET5_4 #if !NETSTANDARD1_3
RuntimeHelpers.PrepareConstrainedRegions(); RuntimeHelpers.PrepareConstrainedRegions();
#endif #endif
try try
@ -1189,7 +1189,7 @@ namespace Microsoft.Net.WebSockets
Contract.Assert(lockObject != null, "'lockObject' MUST NOT be NULL."); Contract.Assert(lockObject != null, "'lockObject' MUST NOT be NULL.");
if (lockTaken) if (lockTaken)
{ {
#if !DOTNET5_4 #if !NETSTANDARD1_3
RuntimeHelpers.PrepareConstrainedRegions(); RuntimeHelpers.PrepareConstrainedRegions();
#endif #endif
try try
@ -2253,7 +2253,7 @@ namespace Microsoft.Net.WebSockets
"'webSocket.m_KeepAliveTracker' MUST NOT be NULL at this point."); "'webSocket.m_KeepAliveTracker' MUST NOT be NULL at this point.");
int keepAliveIntervalMilliseconds = (int)_keepAliveInterval.TotalMilliseconds; int keepAliveIntervalMilliseconds = (int)_keepAliveInterval.TotalMilliseconds;
Contract.Assert(keepAliveIntervalMilliseconds > 0, "'keepAliveIntervalMilliseconds' MUST be POSITIVE."); Contract.Assert(keepAliveIntervalMilliseconds > 0, "'keepAliveIntervalMilliseconds' MUST be POSITIVE.");
#if DOTNET5_4 #if NETSTANDARD1_3
_keepAliveTimer = new Timer(_keepAliveTimerElapsedCallback, webSocket, keepAliveIntervalMilliseconds, Timeout.Infinite); _keepAliveTimer = new Timer(_keepAliveTimerElapsedCallback, webSocket, keepAliveIntervalMilliseconds, Timeout.Infinite);
#else #else
if (ExecutionContext.IsFlowSuppressed()) if (ExecutionContext.IsFlowSuppressed())

View File

@ -28,7 +28,7 @@ using System.Runtime.InteropServices;
namespace Microsoft.Net.WebSockets namespace Microsoft.Net.WebSockets
{ {
#if !DOTNET5_4 #if !NETSTANDARD1_3
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2237:MarkISerializableTypesWithSerializable")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2237:MarkISerializableTypesWithSerializable")]
#endif #endif
internal sealed class WebSocketException : Win32Exception internal sealed class WebSocketException : Win32Exception
@ -115,7 +115,7 @@ namespace Microsoft.Net.WebSockets
: base(message, innerException) : base(message, innerException)
{ {
} }
#if !DOTNET5_4 #if !NETSTANDARD1_3
public override int ErrorCode public override int ErrorCode
{ {
get get

View File

@ -21,7 +21,7 @@
// //
// ==--== // ==--==
#if DOTNET5_4 #if NETSTANDARD1_3
namespace Microsoft.Win32.SafeHandles namespace Microsoft.Win32.SafeHandles
{ {

View File

@ -15,7 +15,7 @@
// See the Apache 2 License for the specific language governing // See the Apache 2 License for the specific language governing
// permissions and limitations under the License. // permissions and limitations under the License.
#if DOTNET5_4 #if NETSTANDARD1_3
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;

View File

@ -21,7 +21,7 @@
// </copyright> // </copyright>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#if DOTNET5_4 #if NETSTANDARD1_3
namespace System namespace System
{ {

View File

@ -31,7 +31,7 @@
** **
=============================================================================*/ =============================================================================*/
#if DOTNET5_4 #if NETSTANDARD1_3
namespace System.Runtime.InteropServices namespace System.Runtime.InteropServices
{ {

View File

@ -21,7 +21,7 @@
// </copyright> // </copyright>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#if DOTNET5_4 #if NETSTANDARD1_3
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;

View File

@ -15,7 +15,7 @@
// See the Apache 2 License for the specific language governing // See the Apache 2 License for the specific language governing
// permissions and limitations under the License. // permissions and limitations under the License.
#if DOTNET5_4 #if NETSTANDARD1_3
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;

View File

@ -8,12 +8,14 @@
"allowUnsafe": true, "allowUnsafe": true,
"warningsAsErrors": true, "warningsAsErrors": true,
"keyFile": "../../tools/Key.snk", "keyFile": "../../tools/Key.snk",
"nowarn": [ "CS1591" ], "nowarn": [
"CS1591"
],
"xmlDoc": true "xmlDoc": true
}, },
"frameworks": { "frameworks": {
"net451": {}, "net451": {},
"dotnet5.4": { "netstandard1.3": {
"dependencies": { "dependencies": {
"System.Collections": "4.0.11-*", "System.Collections": "4.0.11-*",
"System.Linq": "4.1.0-*", "System.Linq": "4.1.0-*",
@ -25,7 +27,10 @@
"System.Threading.Tasks": "4.0.11-*", "System.Threading.Tasks": "4.0.11-*",
"System.Threading.Timer": "4.0.1-*", "System.Threading.Timer": "4.0.1-*",
"System.Threading.ThreadPool": "4.0.10-*" "System.Threading.ThreadPool": "4.0.10-*"
} },
"imports": [
"dotnet5.4"
]
} }
} }
} }

View File

@ -65,7 +65,7 @@ namespace Microsoft.AspNetCore.Server.WebListener
Assert.Equal("Hello World", response); Assert.Equal("Hello World", response);
} }
} }
#if !DNXCORE50 #if !NETSTANDARDAPP1_5
[Fact] [Fact]
public async Task RequestBody_ReadBeginEnd_Success() public async Task RequestBody_ReadBeginEnd_Success()
{ {

View File

@ -94,7 +94,7 @@ namespace Microsoft.AspNetCore.Server.WebListener
Assert.Equal(0, response.ContentLength); Assert.Equal(0, response.ContentLength);
Assert.NotNull(response.Headers["Date"]); Assert.NotNull(response.Headers["Date"]);
Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers["Server"]); Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers["Server"]);
#if DNXCORE50 // WebHeaderCollection.GetValues() not available in CoreCLR. #if NETSTANDARDAPP1_5 // WebHeaderCollection.GetValues() not available in CoreCLR.
Assert.Equal("custom1, and custom2, custom3", response.Headers["WWW-Authenticate"]); Assert.Equal("custom1, and custom2, custom3", response.Headers["WWW-Authenticate"]);
#else #else
Assert.Equal(new string[] { "custom1, and custom2", "custom3" }, response.Headers.GetValues("WWW-Authenticate")); Assert.Equal(new string[] { "custom1, and custom2", "custom3" }, response.Headers.GetValues("WWW-Authenticate"));
@ -122,7 +122,7 @@ namespace Microsoft.AspNetCore.Server.WebListener
Assert.Equal(0, response.ContentLength); Assert.Equal(0, response.ContentLength);
Assert.NotNull(response.Headers["Date"]); Assert.NotNull(response.Headers["Date"]);
Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers["Server"]); Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers["Server"]);
#if DNXCORE50 // WebHeaderCollection.GetValues() not available in CoreCLR. #if NETSTANDARDAPP1_5 // WebHeaderCollection.GetValues() not available in CoreCLR.
Assert.Equal("custom1, and custom2, custom3", response.Headers["Custom-Header1"]); Assert.Equal("custom1, and custom2, custom3", response.Headers["Custom-Header1"]);
#else #else
Assert.Equal(new string[] { "custom1, and custom2", "custom3" }, response.Headers.GetValues("Custom-Header1")); Assert.Equal(new string[] { "custom1, and custom2", "custom3" }, response.Headers.GetValues("Custom-Header1"));

View File

@ -7,14 +7,17 @@
"xunit": "2.1.0" "xunit": "2.1.0"
}, },
"frameworks": { "frameworks": {
"dnxcore50": { "netstandardapp1.5": {
"dependencies": { "dependencies": {
"System.Net.Http.WinHttpHandler": "4.0.0-*", "System.Net.Http.WinHttpHandler": "4.0.0-*",
"System.Net.Requests": "4.0.11-*", "System.Net.Requests": "4.0.11-*",
"System.Net.WebHeaderCollection": "4.0.1-*", "System.Net.WebHeaderCollection": "4.0.1-*",
"dotnet-test-xunit": "1.0.0-dev-*" "dotnet-test-xunit": "1.0.0-dev-*"
}, },
"imports": "portable-net451+win8" "imports": [
"dnxcore50",
"portable-net451+win8"
]
}, },
"net451": { "net451": {
"frameworkAssemblies": { "frameworkAssemblies": {
@ -27,4 +30,4 @@
} }
} }
} }
} }

View File

@ -153,7 +153,7 @@ namespace Microsoft.Net.Http.Server
var context = await server.GetContextAsync(); var context = await server.GetContextAsync();
context.Response.Headers["Content-lenGth"] = " 20 "; context.Response.Headers["Content-lenGth"] = " 20 ";
context.Dispose(); context.Dispose();
#if !DNXCORE50 #if !NETSTANDARDAPP1_5
// HttpClient retries the request because it didn't get a response. // HttpClient retries the request because it didn't get a response.
context = await server.GetContextAsync(); context = await server.GetContextAsync();
context.Response.Headers["Content-lenGth"] = " 20 "; context.Response.Headers["Content-lenGth"] = " 20 ";
@ -175,7 +175,7 @@ namespace Microsoft.Net.Http.Server
context.Response.Headers["Content-lenGth"] = " 20 "; context.Response.Headers["Content-lenGth"] = " 20 ";
context.Response.Body.Write(new byte[5], 0, 5); context.Response.Body.Write(new byte[5], 0, 5);
context.Dispose(); context.Dispose();
#if !DNXCORE50 #if !NETSTANDARDAPP1_5
// HttpClient retries the request because it didn't get a response. // HttpClient retries the request because it didn't get a response.
context = await server.GetContextAsync(); context = await server.GetContextAsync();
context.Response.Headers["Content-lenGth"] = " 20 "; context.Response.Headers["Content-lenGth"] = " 20 ";
@ -199,7 +199,7 @@ namespace Microsoft.Net.Http.Server
context.Response.Body.Write(new byte[5], 0, 5); context.Response.Body.Write(new byte[5], 0, 5);
Assert.Throws<InvalidOperationException>(() => context.Response.Body.Write(new byte[6], 0, 6)); Assert.Throws<InvalidOperationException>(() => context.Response.Body.Write(new byte[6], 0, 6));
context.Dispose(); context.Dispose();
#if !DNXCORE50 #if !NETSTANDARDAPP1_5
// HttpClient retries the request because it didn't get a response. // HttpClient retries the request because it didn't get a response.
context = await server.GetContextAsync(); context = await server.GetContextAsync();
context.Response.Headers["Content-lenGth"] = " 10 "; context.Response.Headers["Content-lenGth"] = " 10 ";

View File

@ -1,4 +1,4 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System; using System;
using System.Linq; using System.Linq;
@ -217,7 +217,7 @@ namespace Microsoft.Net.Http.Server
Assert.Equal(0, response.ContentLength); Assert.Equal(0, response.ContentLength);
Assert.NotNull(response.Headers["Date"]); Assert.NotNull(response.Headers["Date"]);
Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers["Server"]); Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers["Server"]);
#if DNXCORE50 // WebHeaderCollection.GetValues() not available in CoreCLR. #if NETSTANDARDAPP1_5 // WebHeaderCollection.GetValues() not available in CoreCLR.
Assert.Equal("custom1, and custom2, custom3", response.Headers["WWW-Authenticate"]); Assert.Equal("custom1, and custom2, custom3", response.Headers["WWW-Authenticate"]);
#else #else
Assert.Equal(new string[] { "custom1, and custom2", "custom3" }, response.Headers.GetValues("WWW-Authenticate")); Assert.Equal(new string[] { "custom1, and custom2", "custom3" }, response.Headers.GetValues("WWW-Authenticate"));
@ -246,7 +246,7 @@ namespace Microsoft.Net.Http.Server
Assert.Equal(0, response.ContentLength); Assert.Equal(0, response.ContentLength);
Assert.NotNull(response.Headers["Date"]); Assert.NotNull(response.Headers["Date"]);
Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers["Server"]); Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers["Server"]);
#if DNXCORE50 // WebHeaderCollection.GetValues() not available in CoreCLR. #if NETSTANDARDAPP1_5 // WebHeaderCollection.GetValues() not available in CoreCLR.
Assert.Equal("custom1, and custom2, custom3", response.Headers["Custom-Header1"]); Assert.Equal("custom1, and custom2, custom3", response.Headers["Custom-Header1"]);
#else #else
Assert.Equal(new string[] { "custom1, and custom2", "custom3" }, response.Headers.GetValues("Custom-Header1")); Assert.Equal(new string[] { "custom1, and custom2", "custom3" }, response.Headers.GetValues("Custom-Header1"));

View File

@ -123,7 +123,7 @@ namespace Microsoft.Net.Http.Server
context.Abort(); context.Abort();
Assert.True(canceled.WaitOne(interval), "Aborted"); Assert.True(canceled.WaitOne(interval), "Aborted");
Assert.True(ct.IsCancellationRequested, "IsCancellationRequested"); Assert.True(ct.IsCancellationRequested, "IsCancellationRequested");
#if !DNXCORE50 #if !NETSTANDARDAPP1_5
// HttpClient re-tries the request because it doesn't know if the request was received. // HttpClient re-tries the request because it doesn't know if the request was received.
context = await server.GetContextAsync(); context = await server.GetContextAsync();
context.Abort(); context.Abort();

View File

@ -8,7 +8,7 @@
"xunit": "2.1.0" "xunit": "2.1.0"
}, },
"frameworks": { "frameworks": {
"dnxcore50": { "netstandardapp1.5": {
"dependencies": { "dependencies": {
"System.Net.Http": "4.0.1-*", "System.Net.Http": "4.0.1-*",
"System.Net.Http.WinHttpHandler": "4.0.0-*", "System.Net.Http.WinHttpHandler": "4.0.0-*",
@ -16,7 +16,10 @@
"System.Net.WebSockets.Client": "4.0.0-*", "System.Net.WebSockets.Client": "4.0.0-*",
"dotnet-test-xunit": "1.0.0-dev-*" "dotnet-test-xunit": "1.0.0-dev-*"
}, },
"imports": "portable-net451+win8" "imports": [
"dnxcore50",
"portable-net451+win8"
]
}, },
"net451": { "net451": {
"frameworkAssemblies": { "frameworkAssemblies": {
@ -31,4 +34,4 @@
} }
} }
} }
} }