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

Commit b3b846c

Browse files
committed
Remove net451 as a cross-compile target
1 parent 49daa41 commit b3b846c

29 files changed

+88
-113
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ project.lock.json
2828
.build/
2929
.testPublish/
3030
/.vs/
31+
global.json

samples/SampleApp/SampleApp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Import Project="..\..\build\dependencies.props" />
44

55
<PropertyGroup>
6-
<TargetFrameworks>netcoreapp2.0;net451</TargetFrameworks>
6+
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
77
<OutputType>Exe</OutputType>
88
</PropertyGroup>
99

src/Microsoft.AspNetCore.Http.Abstractions/Microsoft.AspNetCore.Http.Abstractions.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Microsoft.AspNetCore.Builder.IApplicationBuilder
1010
Microsoft.AspNetCore.Http.HttpContext
1111
Microsoft.AspNetCore.Http.HttpRequest
1212
Microsoft.AspNetCore.Http.HttpResponse</Description>
13-
<TargetFrameworks>net451;netstandard1.3</TargetFrameworks>
13+
<TargetFramework>netstandard1.3</TargetFramework>
1414
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1515
<PackageTags>aspnetcore</PackageTags>
1616
<NoWarn>$(NoWarn);CS1591</NoWarn>

src/Microsoft.AspNetCore.Http.Extensions/Microsoft.AspNetCore.Http.Extensions.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<PropertyGroup>
66
<Description>ASP.NET Core common extension methods for HTTP abstractions, HTTP headers, HTTP request/response, and session state.</Description>
7-
<TargetFrameworks>net451;netstandard1.3</TargetFrameworks>
7+
<TargetFramework>netstandard1.3</TargetFramework>
88
<NoWarn>$(NoWarn);CS1591</NoWarn>
99
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1010
<PackageTags>aspnetcore</PackageTags>

src/Microsoft.AspNetCore.Http.Features/Microsoft.AspNetCore.Http.Features.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<PropertyGroup>
66
<Description>ASP.NET Core HTTP feature interface definitions.</Description>
7-
<TargetFrameworks>net451;netstandard1.3</TargetFrameworks>
7+
<TargetFramework>netstandard1.3</TargetFramework>
88
<NoWarn>$(NoWarn);CS1591</NoWarn>
99
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1010
<PackageTags>aspnetcore</PackageTags>

src/Microsoft.AspNetCore.Http/FormCollection.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,8 @@ namespace Microsoft.AspNetCore.Http
1515
public class FormCollection : IFormCollection
1616
{
1717
public static readonly FormCollection Empty = new FormCollection();
18-
#if NETSTANDARD1_3
1918
private static readonly string[] EmptyKeys = Array.Empty<string>();
2019
private static readonly StringValues[] EmptyValues = Array.Empty<StringValues>();
21-
#else
22-
private static readonly string[] EmptyKeys = new string[0];
23-
private static readonly StringValues[] EmptyValues = new StringValues[0];
24-
#endif
2520
private static readonly Enumerator EmptyEnumerator = new Enumerator();
2621
// Pre-box
2722
private static readonly IEnumerator<KeyValuePair<string, StringValues>> EmptyIEnumeratorType = EmptyEnumerator;

src/Microsoft.AspNetCore.Http/HeaderDictionary.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,8 @@ namespace Microsoft.AspNetCore.Http
1414
/// </summary>
1515
public class HeaderDictionary : IHeaderDictionary
1616
{
17-
#if NETSTANDARD1_3
1817
private static readonly string[] EmptyKeys = Array.Empty<string>();
1918
private static readonly StringValues[] EmptyValues = Array.Empty<StringValues>();
20-
#else
21-
private static readonly string[] EmptyKeys = new string[0];
22-
private static readonly StringValues[] EmptyValues = new StringValues[0];
23-
#endif
2419
private static readonly Enumerator EmptyEnumerator = new Enumerator();
2520
// Pre-box
2621
private static readonly IEnumerator<KeyValuePair<string, StringValues>> EmptyIEnumeratorType = EmptyEnumerator;
Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,12 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4-
#if NET451
5-
using System;
6-
using System.Runtime.Remoting;
7-
using System.Runtime.Remoting.Messaging;
8-
#elif NETSTANDARD1_3
94
using System.Threading;
10-
#endif
115

126
namespace Microsoft.AspNetCore.Http
137
{
148
public class HttpContextAccessor : IHttpContextAccessor
159
{
16-
#if NET451
17-
private static readonly string LogicalDataKey = "__HttpContext_Current__" + AppDomain.CurrentDomain.Id;
18-
19-
public HttpContext HttpContext
20-
{
21-
get
22-
{
23-
var handle = CallContext.LogicalGetData(LogicalDataKey) as ObjectHandle;
24-
return handle?.Unwrap() as HttpContext;
25-
}
26-
set
27-
{
28-
CallContext.LogicalSetData(LogicalDataKey, new ObjectHandle(value));
29-
}
30-
}
31-
32-
#elif NETSTANDARD1_3
3310
private static AsyncLocal<HttpContext> _httpContextCurrent = new AsyncLocal<HttpContext>();
3411

3512
public HttpContext HttpContext
@@ -43,6 +20,5 @@ public HttpContext HttpContext
4320
_httpContextCurrent.Value = value;
4421
}
4522
}
46-
#endif
4723
}
4824
}

src/Microsoft.AspNetCore.Http/Internal/QueryCollection.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,8 @@ namespace Microsoft.AspNetCore.Http.Internal
1414
public class QueryCollection : IQueryCollection
1515
{
1616
public static readonly QueryCollection Empty = new QueryCollection();
17-
#if NETSTANDARD1_3
1817
private static readonly string[] EmptyKeys = Array.Empty<string>();
1918
private static readonly StringValues[] EmptyValues = Array.Empty<StringValues>();
20-
#else
21-
private static readonly string[] EmptyKeys = new string[0];
22-
private static readonly StringValues[] EmptyValues = new StringValues[0];
23-
#endif
2419
private static readonly Enumerator EmptyEnumerator = new Enumerator();
2520
// Pre-box
2621
private static readonly IEnumerator<KeyValuePair<string, StringValues>> EmptyIEnumeratorType = EmptyEnumerator;

src/Microsoft.AspNetCore.Http/Internal/ReferenceReadStream.cs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public override async Task<int> ReadAsync(byte[] buffer, int offset, int count,
115115
_position += read;
116116
return read;
117117
}
118-
#if NET451
118+
#if NET46
119119
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
120120
{
121121
ThrowIfDisposed();
@@ -164,26 +164,28 @@ public override int EndRead(IAsyncResult asyncResult)
164164
var task = (Task<int>)asyncResult;
165165
return task.GetAwaiter().GetResult();
166166
}
167-
#endif
168-
public override void Write(byte[] buffer, int offset, int count)
167+
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
169168
{
170169
throw new NotSupportedException();
171170
}
172-
public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
171+
172+
public override void EndWrite(IAsyncResult asyncResult)
173173
{
174174
throw new NotSupportedException();
175175
}
176-
#if NET451
177-
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
176+
#elif NETSTANDARD1_3
177+
#else
178+
#error Target frameworks need to be updated.
179+
#endif
180+
public override void Write(byte[] buffer, int offset, int count)
178181
{
179182
throw new NotSupportedException();
180183
}
181-
182-
public override void EndWrite(IAsyncResult asyncResult)
184+
public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
183185
{
184186
throw new NotSupportedException();
185187
}
186-
#endif
188+
187189
public override void SetLength(long value)
188190
{
189191
throw new NotSupportedException();

src/Microsoft.AspNetCore.Http/Internal/RequestCookieCollection.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@ namespace Microsoft.AspNetCore.Http.Internal
1111
public class RequestCookieCollection : IRequestCookieCollection
1212
{
1313
public static readonly RequestCookieCollection Empty = new RequestCookieCollection();
14-
#if NETSTANDARD1_3
1514
private static readonly string[] EmptyKeys = Array.Empty<string>();
16-
#else
17-
private static readonly string[] EmptyKeys = new string[0];
18-
#endif
1915
private static readonly Enumerator EmptyEnumerator = new Enumerator();
2016
// Pre-box
2117
private static readonly IEnumerator<KeyValuePair<string, string>> EmptyIEnumeratorType = EmptyEnumerator;

src/Microsoft.AspNetCore.Http/Microsoft.AspNetCore.Http.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<PropertyGroup>
66
<Description>ASP.NET Core default HTTP feature implementations.</Description>
7-
<TargetFrameworks>net451;netstandard1.3</TargetFrameworks>
7+
<TargetFrameworks>netstandard1.3;net46</TargetFrameworks>
88
<NoWarn>$(NoWarn);CS1591</NoWarn>
99
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1010
<GenerateDocumentationFile>true</GenerateDocumentationFile>

src/Microsoft.AspNetCore.Owin/Microsoft.AspNetCore.Owin.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<PropertyGroup>
66
<Description>ASP.NET Core component for running OWIN middleware in an ASP.NET Core application, and to run ASP.NET Core middleware in an OWIN application.</Description>
7-
<TargetFrameworks>net451;netstandard1.3</TargetFrameworks>
7+
<TargetFramework>netstandard1.3</TargetFramework>
88
<NoWarn>$(NoWarn);CS1591</NoWarn>
99
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1010
<PackageTags>aspnetcore;owin</PackageTags>

src/Microsoft.AspNetCore.WebUtilities/BufferedReadStream.cs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -162,17 +162,7 @@ public override void Write(byte[] buffer, int offset, int count)
162162
{
163163
_inner.Write(buffer, offset, count);
164164
}
165-
#if NET451
166-
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
167-
{
168-
return _inner.BeginWrite(buffer, offset, count, callback, state);
169-
}
170165

171-
public override void EndWrite(IAsyncResult asyncResult)
172-
{
173-
_inner.EndWrite(asyncResult);
174-
}
175-
#endif
176166
public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
177167
{
178168
return _inner.WriteAsync(buffer, offset, count, cancellationToken);
@@ -211,7 +201,17 @@ public async override Task<int> ReadAsync(byte[] buffer, int offset, int count,
211201

212202
return await _inner.ReadAsync(buffer, offset, count, cancellationToken);
213203
}
214-
#if NET451
204+
#if NET46
205+
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
206+
{
207+
return _inner.BeginWrite(buffer, offset, count, callback, state);
208+
}
209+
210+
public override void EndWrite(IAsyncResult asyncResult)
211+
{
212+
_inner.EndWrite(asyncResult);
213+
}
214+
215215
// We only anticipate using ReadAsync
216216
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
217217
{
@@ -262,6 +262,9 @@ public override int EndRead(IAsyncResult asyncResult)
262262
}
263263
return _inner.EndRead(asyncResult);
264264
}
265+
#elif NETSTANDARD1_3
266+
#else
267+
#error Target frameworks need to be updated.
265268
#endif
266269
public bool EnsureBuffered()
267270
{

src/Microsoft.AspNetCore.WebUtilities/FileBufferingReadStream.cs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ public override int Read(byte[] buffer, int offset, int count)
250250

251251
return read;
252252
}
253-
#if NET451
253+
#if NET46
254254
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
255255
{
256256
ThrowIfDisposed();
@@ -298,6 +298,19 @@ public override int EndRead(IAsyncResult asyncResult)
298298
var task = (Task<int>)asyncResult;
299299
return task.GetAwaiter().GetResult();
300300
}
301+
302+
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
303+
{
304+
throw new NotSupportedException();
305+
}
306+
307+
public override void EndWrite(IAsyncResult asyncResult)
308+
{
309+
throw new NotSupportedException();
310+
}
311+
#elif NETSTANDARD1_3
312+
#else
313+
#error Target frameworks need to be updated.
301314
#endif
302315
public override async Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
303316
{
@@ -358,17 +371,7 @@ public override void Write(byte[] buffer, int offset, int count)
358371
{
359372
throw new NotSupportedException();
360373
}
361-
#if NET451
362-
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
363-
{
364-
throw new NotSupportedException();
365-
}
366374

367-
public override void EndWrite(IAsyncResult asyncResult)
368-
{
369-
throw new NotSupportedException();
370-
}
371-
#endif
372375
public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
373376
{
374377
throw new NotSupportedException();

src/Microsoft.AspNetCore.WebUtilities/HttpRequestStreamReader.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,14 @@ public HttpRequestStreamReader(
108108
}
109109
}
110110

111-
#if NET451
111+
#if NET46
112112
public override void Close()
113113
{
114114
Dispose(true);
115115
}
116+
#elif NETSTANDARD1_3
117+
#else
118+
#error Target frameworks need to be updated.
116119
#endif
117120

118121
protected override void Dispose(bool disposing)

src/Microsoft.AspNetCore.WebUtilities/Microsoft.AspNetCore.WebUtilities.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<PropertyGroup>
66
<Description>ASP.NET Core utilities, such as for working with forms, multipart messages, and query strings.</Description>
7-
<TargetFrameworks>net451;netstandard1.3</TargetFrameworks>
7+
<TargetFrameworks>netstandard1.3;net46</TargetFrameworks>
88
<DefineConstants>$(DefineConstants);WebEncoders_In_WebUtilities</DefineConstants>
99
<NoWarn>$(NoWarn);CS1591</NoWarn>
1010
<GenerateDocumentationFile>true</GenerateDocumentationFile>

src/Microsoft.AspNetCore.WebUtilities/MultipartReaderStream.cs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -126,17 +126,7 @@ public override void Write(byte[] buffer, int offset, int count)
126126
{
127127
throw new NotSupportedException();
128128
}
129-
#if NET451
130-
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int size, AsyncCallback callback, object state)
131-
{
132-
throw new NotSupportedException();
133-
}
134129

135-
public override void EndWrite(IAsyncResult asyncResult)
136-
{
137-
throw new NotSupportedException();
138-
}
139-
#endif
140130
public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
141131
{
142132
throw new NotSupportedException();
@@ -168,7 +158,17 @@ private int UpdatePosition(int read)
168158
}
169159
return read;
170160
}
171-
#if NET451
161+
#if NET46
162+
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int size, AsyncCallback callback, object state)
163+
{
164+
throw new NotSupportedException();
165+
}
166+
167+
public override void EndWrite(IAsyncResult asyncResult)
168+
{
169+
throw new NotSupportedException();
170+
}
171+
172172
public override IAsyncResult BeginRead(byte[] buffer, int offset, int size, AsyncCallback callback, object state)
173173
{
174174
var tcs = new TaskCompletionSource<int>(state);
@@ -215,6 +215,9 @@ public override int EndRead(IAsyncResult asyncResult)
215215
var task = (Task<int>)asyncResult;
216216
return task.GetAwaiter().GetResult();
217217
}
218+
#elif NETSTANDARD1_3
219+
#else
220+
#error Target frameworks need to be updated.
218221
#endif
219222
public override int Read(byte[] buffer, int offset, int count)
220223
{
@@ -231,10 +234,8 @@ public override int Read(byte[] buffer, int offset, int count)
231234
var bufferedData = _innerStream.BufferedData;
232235

233236
// scan for a boundary match, full or partial.
234-
int matchOffset;
235-
int matchCount;
236237
int read;
237-
if (SubMatch(bufferedData, _boundary.BoundaryBytes, out matchOffset, out matchCount))
238+
if (SubMatch(bufferedData, _boundary.BoundaryBytes, out var matchOffset, out var matchCount))
238239
{
239240
// We found a possible match, return any data before it.
240241
if (matchOffset > bufferedData.Offset)

src/Microsoft.Net.Http.Headers/Microsoft.Net.Http.Headers.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<PropertyGroup>
66
<Description>HTTP header parser implementations.</Description>
7-
<TargetFrameworks>net451;netstandard1.1</TargetFrameworks>
7+
<TargetFramework>netstandard1.1</TargetFramework>
88
<NoWarn>$(NoWarn);CS1591</NoWarn>
99
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1010
<GenerateDocumentationFile>true</GenerateDocumentationFile>

test/Microsoft.AspNetCore.Http.Abstractions.Tests/Microsoft.AspNetCore.Http.Abstractions.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Import Project="..\..\build\common.props" />
44

55
<PropertyGroup>
6-
<TargetFrameworks>netcoreapp2.0;net452</TargetFrameworks>
6+
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
77
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
88
</PropertyGroup>
99

0 commit comments

Comments
 (0)