From 16be9a264e48560e10a3ee9683ecaed342d4ca11 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Wed, 16 Oct 2019 17:09:54 -0700 Subject: [PATCH 01/24] Don't re-use DefaultHttpContext if IHttpContextAccessor is in use (#15049) * Don't re-use DefaultHttpContext if IHttpContextAccessor is in use - Consumers may still get null or an ODE but will never end up with data from a different request. - Make sure an ODE is thrown from all properties on HttpContext after the request is over. --- .../src/Http/DefaultHttpContextFactory.cs | 2 + .../src/Internal/HostingApplication.cs | 8 + .../HostingApplicationDiagnosticsTests.cs | 532 ++++++++++++++++ .../Hosting/test/HostingApplicationTests.cs | 574 +++--------------- src/Http/Http/src/DefaultHttpContext.cs | 4 +- 5 files changed, 633 insertions(+), 487 deletions(-) create mode 100644 src/Hosting/Hosting/test/HostingApplicationDiagnosticsTests.cs diff --git a/src/Hosting/Hosting/src/Http/DefaultHttpContextFactory.cs b/src/Hosting/Hosting/src/Http/DefaultHttpContextFactory.cs index 08ecd9b057..2637a8b3a6 100644 --- a/src/Hosting/Hosting/src/Http/DefaultHttpContextFactory.cs +++ b/src/Hosting/Hosting/src/Http/DefaultHttpContextFactory.cs @@ -26,6 +26,8 @@ namespace Microsoft.AspNetCore.Http _serviceScopeFactory = serviceProvider.GetRequiredService(); } + internal IHttpContextAccessor HttpContextAccessor => _httpContextAccessor; + public HttpContext Create(IFeatureCollection featureCollection) { if (featureCollection is null) diff --git a/src/Hosting/Hosting/src/Internal/HostingApplication.cs b/src/Hosting/Hosting/src/Internal/HostingApplication.cs index 84363221ba..8432661215 100644 --- a/src/Hosting/Hosting/src/Internal/HostingApplication.cs +++ b/src/Hosting/Hosting/src/Internal/HostingApplication.cs @@ -96,6 +96,14 @@ namespace Microsoft.AspNetCore.Hosting if (_defaultHttpContextFactory != null) { _defaultHttpContextFactory.Dispose((DefaultHttpContext)httpContext); + + if (_defaultHttpContextFactory.HttpContextAccessor != null) + { + // Clear the HttpContext if the accessor was used. It's likely that the lifetime extends + // past the end of the http request and we want to avoid changing the reference from under + // consumers. + context.HttpContext = null; + } } else { diff --git a/src/Hosting/Hosting/test/HostingApplicationDiagnosticsTests.cs b/src/Hosting/Hosting/test/HostingApplicationDiagnosticsTests.cs new file mode 100644 index 0000000000..385424fa67 --- /dev/null +++ b/src/Hosting/Hosting/test/HostingApplicationDiagnosticsTests.cs @@ -0,0 +1,532 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Reflection; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Http.Features; +using Microsoft.Extensions.Logging; +using Moq; +using Xunit; + +namespace Microsoft.AspNetCore.Hosting.Tests +{ + public class HostingApplicationDiagnosticsTests + { + [Fact] + public void DisposeContextDoesNotThrowWhenContextScopeIsNull() + { + // Arrange + var hostingApplication = CreateApplication(out var features); + var context = hostingApplication.CreateContext(features); + + // Act/Assert + hostingApplication.DisposeContext(context, null); + } + + [Fact] + public void CreateContextWithDisabledLoggerDoesNotCreateActivity() + { + // Arrange + var hostingApplication = CreateApplication(out var features); + + // Act + hostingApplication.CreateContext(features); + + Assert.Null(Activity.Current); + } + + [Fact] + public void CreateContextWithEnabledLoggerCreatesActivityAndSetsActivityInScope() + { + // Arrange + var logger = new LoggerWithScopes(isEnabled: true); + var hostingApplication = CreateApplication(out var features, logger: logger); + + // Act + var context = hostingApplication.CreateContext(features); + + Assert.Single(logger.Scopes); + var pairs = ((IReadOnlyList>)logger.Scopes[0]).ToDictionary(p => p.Key, p => p.Value); + Assert.Equal(Activity.Current.Id, pairs["SpanId"].ToString()); + Assert.Equal(Activity.Current.RootId, pairs["TraceId"].ToString()); + Assert.Equal(string.Empty, pairs["ParentId"]?.ToString()); + } + + [Fact] + public void CreateContextWithEnabledLoggerAndRequestIdCreatesActivityAndSetsActivityInScope() + { + // Arrange + + // Generate an id we can use for the request id header (in the correct format) + var activity = new Activity("IncomingRequest"); + activity.Start(); + var id = activity.Id; + activity.Stop(); + + var logger = new LoggerWithScopes(isEnabled: true); + var hostingApplication = CreateApplication(out var features, logger: logger, configure: context => + { + context.Request.Headers["Request-Id"] = id; + }); + + // Act + var context = hostingApplication.CreateContext(features); + + Assert.Single(logger.Scopes); + var pairs = ((IReadOnlyList>)logger.Scopes[0]).ToDictionary(p => p.Key, p => p.Value); + Assert.Equal(Activity.Current.Id, pairs["SpanId"].ToString()); + Assert.Equal(Activity.Current.RootId, pairs["TraceId"].ToString()); + Assert.Equal(id, pairs["ParentId"].ToString()); + } + + [Fact] + public void ActivityStopDoesNotFireIfNoListenerAttachedForStart() + { + // Arrange + var diagnosticListener = new DiagnosticListener("DummySource"); + var logger = new LoggerWithScopes(isEnabled: true); + var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener, logger: logger); + var startFired = false; + var stopFired = false; + + diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => + { + // This should not fire + if (pair.Key == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Start") + { + startFired = true; + } + + // This should not fire + if (pair.Key == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Stop") + { + stopFired = true; + } + }), + (s, o, arg3) => + { + // The events are off + return false; + }); + + + // Act + var context = hostingApplication.CreateContext(features); + + hostingApplication.DisposeContext(context, exception: null); + + Assert.False(startFired); + Assert.False(stopFired); + Assert.Null(Activity.Current); + } + + [Fact] + public void ActivityIsNotCreatedWhenIsEnabledForActivityIsFalse() + { + var diagnosticListener = new DiagnosticListener("DummySource"); + var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener); + + bool eventsFired = false; + bool isEnabledActivityFired = false; + bool isEnabledStartFired = false; + + diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => + { + eventsFired |= pair.Key.StartsWith("Microsoft.AspNetCore.Hosting.HttpRequestIn"); + }), (s, o, arg3) => + { + if (s == "Microsoft.AspNetCore.Hosting.HttpRequestIn") + { + Assert.IsAssignableFrom(o); + isEnabledActivityFired = true; + } + if (s == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Start") + { + isEnabledStartFired = true; + } + return false; + }); + + hostingApplication.CreateContext(features); + Assert.Null(Activity.Current); + Assert.True(isEnabledActivityFired); + Assert.False(isEnabledStartFired); + Assert.False(eventsFired); + } + + [Fact] + public void ActivityIsCreatedButNotLoggedWhenIsEnabledForActivityStartIsFalse() + { + var diagnosticListener = new DiagnosticListener("DummySource"); + var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener); + + bool eventsFired = false; + bool isEnabledStartFired = false; + bool isEnabledActivityFired = false; + + diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => + { + eventsFired |= pair.Key.StartsWith("Microsoft.AspNetCore.Hosting.HttpRequestIn"); + }), (s, o, arg3) => + { + if (s == "Microsoft.AspNetCore.Hosting.HttpRequestIn") + { + Assert.IsAssignableFrom(o); + isEnabledActivityFired = true; + return true; + } + + if (s == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Start") + { + isEnabledStartFired = true; + return false; + } + return true; + }); + + hostingApplication.CreateContext(features); + Assert.NotNull(Activity.Current); + Assert.True(isEnabledActivityFired); + Assert.True(isEnabledStartFired); + Assert.False(eventsFired); + } + + [Fact] + public void ActivityIsCreatedAndLogged() + { + var diagnosticListener = new DiagnosticListener("DummySource"); + var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener); + + bool startCalled = false; + + diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => + { + if (pair.Key == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Start") + { + startCalled = true; + Assert.NotNull(pair.Value); + Assert.NotNull(Activity.Current); + Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); + AssertProperty(pair.Value, "HttpContext"); + } + })); + + hostingApplication.CreateContext(features); + Assert.NotNull(Activity.Current); + Assert.True(startCalled); + } + + [Fact] + public void ActivityIsStoppedDuringStopCall() + { + var diagnosticListener = new DiagnosticListener("DummySource"); + var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener); + + bool endCalled = false; + diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => + { + if (pair.Key == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Stop") + { + endCalled = true; + + Assert.NotNull(Activity.Current); + Assert.True(Activity.Current.Duration > TimeSpan.Zero); + Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); + AssertProperty(pair.Value, "HttpContext"); + } + })); + + var context = hostingApplication.CreateContext(features); + hostingApplication.DisposeContext(context, null); + Assert.True(endCalled); + } + + [Fact] + public void ActivityIsStoppedDuringUnhandledExceptionCall() + { + var diagnosticListener = new DiagnosticListener("DummySource"); + var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener); + + bool endCalled = false; + diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => + { + if (pair.Key == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Stop") + { + endCalled = true; + Assert.NotNull(Activity.Current); + Assert.True(Activity.Current.Duration > TimeSpan.Zero); + Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); + AssertProperty(pair.Value, "HttpContext"); + } + })); + + var context = hostingApplication.CreateContext(features); + hostingApplication.DisposeContext(context, new Exception()); + Assert.True(endCalled); + } + + [Fact] + public void ActivityIsAvailableDuringUnhandledExceptionCall() + { + var diagnosticListener = new DiagnosticListener("DummySource"); + var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener); + + bool endCalled = false; + diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => + { + if (pair.Key == "Microsoft.AspNetCore.Hosting.UnhandledException") + { + endCalled = true; + Assert.NotNull(Activity.Current); + Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); + } + })); + + var context = hostingApplication.CreateContext(features); + hostingApplication.DisposeContext(context, new Exception()); + Assert.True(endCalled); + } + + [Fact] + public void ActivityIsAvailibleDuringRequest() + { + var diagnosticListener = new DiagnosticListener("DummySource"); + var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener); + + diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => { }), + s => + { + if (s.StartsWith("Microsoft.AspNetCore.Hosting.HttpRequestIn")) + { + return true; + } + return false; + }); + + hostingApplication.CreateContext(features); + + Assert.NotNull(Activity.Current); + Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); + } + + [Fact] + public void ActivityParentIdAndBaggeReadFromHeaders() + { + var diagnosticListener = new DiagnosticListener("DummySource"); + var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener); + + diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => { }), + s => + { + if (s.StartsWith("Microsoft.AspNetCore.Hosting.HttpRequestIn")) + { + return true; + } + return false; + }); + + features.Set(new HttpRequestFeature() + { + Headers = new HeaderDictionary() + { + {"Request-Id", "ParentId1"}, + {"Correlation-Context", "Key1=value1, Key2=value2"} + } + }); + hostingApplication.CreateContext(features); + Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); + Assert.Equal("ParentId1", Activity.Current.ParentId); + Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key1" && pair.Value == "value1"); + Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key2" && pair.Value == "value2"); + } + + + [Fact] + public void ActivityTraceParentAndTraceStateFromHeaders() + { + var diagnosticListener = new DiagnosticListener("DummySource"); + var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener); + + diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => { }), + s => + { + if (s.StartsWith("Microsoft.AspNetCore.Hosting.HttpRequestIn")) + { + return true; + } + return false; + }); + + features.Set(new HttpRequestFeature() + { + Headers = new HeaderDictionary() + { + {"traceparent", "00-0123456789abcdef0123456789abcdef-0123456789abcdef-01"}, + {"tracestate", "TraceState1"}, + {"Correlation-Context", "Key1=value1, Key2=value2"} + } + }); + hostingApplication.CreateContext(features); + Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); + Assert.Equal(ActivityIdFormat.W3C, Activity.Current.IdFormat); + Assert.Equal("0123456789abcdef0123456789abcdef", Activity.Current.TraceId.ToHexString()); + Assert.Equal("0123456789abcdef", Activity.Current.ParentSpanId.ToHexString()); + Assert.Equal("TraceState1", Activity.Current.TraceStateString); + + Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key1" && pair.Value == "value1"); + Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key2" && pair.Value == "value2"); + } + + [Fact] + public void ActivityOnExportHookIsCalled() + { + var diagnosticListener = new DiagnosticListener("DummySource"); + var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener); + + bool onActivityImportCalled = false; + diagnosticListener.Subscribe( + observer: new CallbackDiagnosticListener(pair => { }), + isEnabled: (s, o, _) => true, + onActivityImport: (activity, context) => + { + onActivityImportCalled = true; + Assert.Null(Activity.Current); + Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", activity.OperationName); + Assert.NotNull(context); + Assert.IsAssignableFrom(context); + + activity.ActivityTraceFlags = ActivityTraceFlags.Recorded; + }); + + hostingApplication.CreateContext(features); + + Assert.True(onActivityImportCalled); + Assert.NotNull(Activity.Current); + Assert.True(Activity.Current.Recorded); + } + + + private static void AssertProperty(object o, string name) + { + Assert.NotNull(o); + var property = o.GetType().GetTypeInfo().GetProperty(name, BindingFlags.Instance | BindingFlags.Public); + Assert.NotNull(property); + var value = property.GetValue(o); + Assert.NotNull(value); + Assert.IsAssignableFrom(value); + } + + private static HostingApplication CreateApplication(out FeatureCollection features, + DiagnosticListener diagnosticListener = null, ILogger logger = null, Action configure = null) + { + var httpContextFactory = new Mock(); + + features = new FeatureCollection(); + features.Set(new HttpRequestFeature()); + var context = new DefaultHttpContext(features); + configure?.Invoke(context); + httpContextFactory.Setup(s => s.Create(It.IsAny())).Returns(context); + httpContextFactory.Setup(s => s.Dispose(It.IsAny())); + + var hostingApplication = new HostingApplication( + ctx => Task.CompletedTask, + logger ?? new NullScopeLogger(), + diagnosticListener ?? new NoopDiagnosticListener(), + httpContextFactory.Object); + + return hostingApplication; + } + + private class NullScopeLogger : ILogger + { + private readonly bool _isEnabled; + public NullScopeLogger(bool isEnabled = false) + { + _isEnabled = isEnabled; + } + + public IDisposable BeginScope(TState state) => null; + + public bool IsEnabled(LogLevel logLevel) => _isEnabled; + + public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) + { + } + } + + private class LoggerWithScopes : ILogger + { + private readonly bool _isEnabled; + public LoggerWithScopes(bool isEnabled = false) + { + _isEnabled = isEnabled; + } + + public IDisposable BeginScope(TState state) + { + Scopes.Add(state); + return new Scope(); + } + + public List Scopes { get; set; } = new List(); + + public bool IsEnabled(LogLevel logLevel) => _isEnabled; + + public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) + { + + } + + private class Scope : IDisposable + { + public void Dispose() + { + } + } + } + + private class NoopDiagnosticListener : DiagnosticListener + { + private readonly bool _isEnabled; + + public NoopDiagnosticListener(bool isEnabled = false) : base("DummyListener") + { + _isEnabled = isEnabled; + } + + public override bool IsEnabled(string name) => _isEnabled; + + public override void Write(string name, object value) + { + } + } + + private class CallbackDiagnosticListener : IObserver> + { + private readonly Action> _callback; + + public CallbackDiagnosticListener(Action> callback) + { + _callback = callback; + } + + public void OnNext(KeyValuePair value) + { + _callback(value); + } + + public void OnError(Exception error) + { + } + + public void OnCompleted() + { + } + } + } +} diff --git a/src/Hosting/Hosting/test/HostingApplicationTests.cs b/src/Hosting/Hosting/test/HostingApplicationTests.cs index 64d832eb0c..4dd9863718 100644 --- a/src/Hosting/Hosting/test/HostingApplicationTests.cs +++ b/src/Hosting/Hosting/test/HostingApplicationTests.cs @@ -1,532 +1,136 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - using System; +using System.Collections; using System.Collections.Generic; using System.Diagnostics; -using System.Linq; -using System.Reflection; using System.Threading.Tasks; +using Microsoft.AspNetCore.Hosting.Server.Abstractions; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging.Abstractions; using Moq; using Xunit; +using static Microsoft.AspNetCore.Hosting.HostingApplication; namespace Microsoft.AspNetCore.Hosting.Tests { public class HostingApplicationTests { [Fact] - public void DisposeContextDoesNotThrowWhenContextScopeIsNull() + public void DisposeContextDoesNotClearHttpContextIfDefaultHttpContextFactoryUsed() { // Arrange - var hostingApplication = CreateApplication(out var features); + var hostingApplication = CreateApplication(); + var httpContext = new DefaultHttpContext(); + + var context = hostingApplication.CreateContext(httpContext.Features); + Assert.NotNull(context.HttpContext); + + // Act/Assert + hostingApplication.DisposeContext(context, null); + Assert.NotNull(context.HttpContext); + } + + [Fact] + public void DisposeContextClearsHttpContextIfIHttpContextAccessorIsActive() + { + // Arrange + var hostingApplication = CreateApplication(useHttpContextAccessor: true); + var httpContext = new DefaultHttpContext(); + + var context = hostingApplication.CreateContext(httpContext.Features); + Assert.NotNull(context.HttpContext); + + // Act/Assert + hostingApplication.DisposeContext(context, null); + Assert.Null(context.HttpContext); + } + + [Fact] + public void CreateContextReinitializesPreviouslyStoredDefaultHttpContext() + { + // Arrange + var hostingApplication = CreateApplication(); + var features = new FeaturesWithContext(new DefaultHttpContext().Features); + var previousContext = new DefaultHttpContext(); + // Pretend like we had previous HttpContext + features.HostContext = new Context(); + features.HostContext.HttpContext = previousContext; + var context = hostingApplication.CreateContext(features); + Assert.Same(previousContext, context.HttpContext); + + // Act/Assert + hostingApplication.DisposeContext(context, null); + Assert.Same(previousContext, context.HttpContext); + } + + [Fact] + public void CreateContextCreatesNewContextIfNotUsingDefaultHttpContextFactory() + { + // Arrange + var factory = new Mock(); + factory.Setup(m => m.Create(It.IsAny())).Returns(f => new DefaultHttpContext(f)); + factory.Setup(m => m.Dispose(It.IsAny())).Callback(() => { }); + + var hostingApplication = CreateApplication(factory.Object); + var features = new FeaturesWithContext(new DefaultHttpContext().Features); + var previousContext = new DefaultHttpContext(); + // Pretend like we had previous HttpContext + features.HostContext = new Context(); + features.HostContext.HttpContext = previousContext; + + var context = hostingApplication.CreateContext(features); + Assert.NotSame(previousContext, context.HttpContext); // Act/Assert hostingApplication.DisposeContext(context, null); } - [Fact] - public void CreateContextWithDisabledLoggerDoesNotCreateActivity() + private static HostingApplication CreateApplication(IHttpContextFactory httpContextFactory = null, bool useHttpContextAccessor = false) { - // Arrange - var hostingApplication = CreateApplication(out var features); - - // Act - hostingApplication.CreateContext(features); - - Assert.Null(Activity.Current); - } - - [Fact] - public void CreateContextWithEnabledLoggerCreatesActivityAndSetsActivityInScope() - { - // Arrange - var logger = new LoggerWithScopes(isEnabled: true); - var hostingApplication = CreateApplication(out var features, logger: logger); - - // Act - var context = hostingApplication.CreateContext(features); - - Assert.Single(logger.Scopes); - var pairs = ((IReadOnlyList>)logger.Scopes[0]).ToDictionary(p => p.Key, p => p.Value); - Assert.Equal(Activity.Current.Id, pairs["SpanId"].ToString()); - Assert.Equal(Activity.Current.RootId, pairs["TraceId"].ToString()); - Assert.Equal(string.Empty, pairs["ParentId"]?.ToString()); - } - - [Fact] - public void CreateContextWithEnabledLoggerAndRequestIdCreatesActivityAndSetsActivityInScope() - { - // Arrange - - // Generate an id we can use for the request id header (in the correct format) - var activity = new Activity("IncomingRequest"); - activity.Start(); - var id = activity.Id; - activity.Stop(); - - var logger = new LoggerWithScopes(isEnabled: true); - var hostingApplication = CreateApplication(out var features, logger: logger, configure: context => + var services = new ServiceCollection(); + services.AddOptions(); + if (useHttpContextAccessor) { - context.Request.Headers["Request-Id"] = id; - }); + services.AddHttpContextAccessor(); + } - // Act - var context = hostingApplication.CreateContext(features); - - Assert.Single(logger.Scopes); - var pairs = ((IReadOnlyList>)logger.Scopes[0]).ToDictionary(p => p.Key, p => p.Value); - Assert.Equal(Activity.Current.Id, pairs["SpanId"].ToString()); - Assert.Equal(Activity.Current.RootId, pairs["TraceId"].ToString()); - Assert.Equal(id, pairs["ParentId"].ToString()); - } - - [Fact] - public void ActivityStopDoesNotFireIfNoListenerAttachedForStart() - { - // Arrange - var diagnosticListener = new DiagnosticListener("DummySource"); - var logger = new LoggerWithScopes(isEnabled: true); - var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener, logger: logger); - var startFired = false; - var stopFired = false; - - diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => - { - // This should not fire - if (pair.Key == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Start") - { - startFired = true; - } - - // This should not fire - if (pair.Key == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Stop") - { - stopFired = true; - } - }), - (s, o, arg3) => - { - // The events are off - return false; - }); - - - // Act - var context = hostingApplication.CreateContext(features); - - hostingApplication.DisposeContext(context, exception: null); - - Assert.False(startFired); - Assert.False(stopFired); - Assert.Null(Activity.Current); - } - - [Fact] - public void ActivityIsNotCreatedWhenIsEnabledForActivityIsFalse() - { - var diagnosticListener = new DiagnosticListener("DummySource"); - var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener); - - bool eventsFired = false; - bool isEnabledActivityFired = false; - bool isEnabledStartFired = false; - - diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => - { - eventsFired |= pair.Key.StartsWith("Microsoft.AspNetCore.Hosting.HttpRequestIn"); - }), (s, o, arg3) => - { - if (s == "Microsoft.AspNetCore.Hosting.HttpRequestIn") - { - Assert.IsAssignableFrom(o); - isEnabledActivityFired = true; - } - if (s == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Start") - { - isEnabledStartFired = true; - } - return false; - }); - - hostingApplication.CreateContext(features); - Assert.Null(Activity.Current); - Assert.True(isEnabledActivityFired); - Assert.False(isEnabledStartFired); - Assert.False(eventsFired); - } - - [Fact] - public void ActivityIsCreatedButNotLoggedWhenIsEnabledForActivityStartIsFalse() - { - var diagnosticListener = new DiagnosticListener("DummySource"); - var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener); - - bool eventsFired = false; - bool isEnabledStartFired = false; - bool isEnabledActivityFired = false; - - diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => - { - eventsFired |= pair.Key.StartsWith("Microsoft.AspNetCore.Hosting.HttpRequestIn"); - }), (s, o, arg3) => - { - if (s == "Microsoft.AspNetCore.Hosting.HttpRequestIn") - { - Assert.IsAssignableFrom(o); - isEnabledActivityFired = true; - return true; - } - - if (s == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Start") - { - isEnabledStartFired = true; - return false; - } - return true; - }); - - hostingApplication.CreateContext(features); - Assert.NotNull(Activity.Current); - Assert.True(isEnabledActivityFired); - Assert.True(isEnabledStartFired); - Assert.False(eventsFired); - } - - [Fact] - public void ActivityIsCreatedAndLogged() - { - var diagnosticListener = new DiagnosticListener("DummySource"); - var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener); - - bool startCalled = false; - - diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => - { - if (pair.Key == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Start") - { - startCalled = true; - Assert.NotNull(pair.Value); - Assert.NotNull(Activity.Current); - Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); - AssertProperty(pair.Value, "HttpContext"); - } - })); - - hostingApplication.CreateContext(features); - Assert.NotNull(Activity.Current); - Assert.True(startCalled); - } - - [Fact] - public void ActivityIsStoppedDuringStopCall() - { - var diagnosticListener = new DiagnosticListener("DummySource"); - var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener); - - bool endCalled = false; - diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => - { - if (pair.Key == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Stop") - { - endCalled = true; - - Assert.NotNull(Activity.Current); - Assert.True(Activity.Current.Duration > TimeSpan.Zero); - Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); - AssertProperty(pair.Value, "HttpContext"); - } - })); - - var context = hostingApplication.CreateContext(features); - hostingApplication.DisposeContext(context, null); - Assert.True(endCalled); - } - - [Fact] - public void ActivityIsStoppedDuringUnhandledExceptionCall() - { - var diagnosticListener = new DiagnosticListener("DummySource"); - var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener); - - bool endCalled = false; - diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => - { - if (pair.Key == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Stop") - { - endCalled = true; - Assert.NotNull(Activity.Current); - Assert.True(Activity.Current.Duration > TimeSpan.Zero); - Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); - AssertProperty(pair.Value, "HttpContext"); - } - })); - - var context = hostingApplication.CreateContext(features); - hostingApplication.DisposeContext(context, new Exception()); - Assert.True(endCalled); - } - - [Fact] - public void ActivityIsAvailableDuringUnhandledExceptionCall() - { - var diagnosticListener = new DiagnosticListener("DummySource"); - var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener); - - bool endCalled = false; - diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => - { - if (pair.Key == "Microsoft.AspNetCore.Hosting.UnhandledException") - { - endCalled = true; - Assert.NotNull(Activity.Current); - Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); - } - })); - - var context = hostingApplication.CreateContext(features); - hostingApplication.DisposeContext(context, new Exception()); - Assert.True(endCalled); - } - - [Fact] - public void ActivityIsAvailibleDuringRequest() - { - var diagnosticListener = new DiagnosticListener("DummySource"); - var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener); - - diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => { }), - s => - { - if (s.StartsWith("Microsoft.AspNetCore.Hosting.HttpRequestIn")) - { - return true; - } - return false; - }); - - hostingApplication.CreateContext(features); - - Assert.NotNull(Activity.Current); - Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); - } - - [Fact] - public void ActivityParentIdAndBaggeReadFromHeaders() - { - var diagnosticListener = new DiagnosticListener("DummySource"); - var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener); - - diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => { }), - s => - { - if (s.StartsWith("Microsoft.AspNetCore.Hosting.HttpRequestIn")) - { - return true; - } - return false; - }); - - features.Set(new HttpRequestFeature() - { - Headers = new HeaderDictionary() - { - {"Request-Id", "ParentId1"}, - {"Correlation-Context", "Key1=value1, Key2=value2"} - } - }); - hostingApplication.CreateContext(features); - Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); - Assert.Equal("ParentId1", Activity.Current.ParentId); - Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key1" && pair.Value == "value1"); - Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key2" && pair.Value == "value2"); - } - - - [Fact] - public void ActivityTraceParentAndTraceStateFromHeaders() - { - var diagnosticListener = new DiagnosticListener("DummySource"); - var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener); - - diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => { }), - s => - { - if (s.StartsWith("Microsoft.AspNetCore.Hosting.HttpRequestIn")) - { - return true; - } - return false; - }); - - features.Set(new HttpRequestFeature() - { - Headers = new HeaderDictionary() - { - {"traceparent", "00-0123456789abcdef0123456789abcdef-0123456789abcdef-01"}, - {"tracestate", "TraceState1"}, - {"Correlation-Context", "Key1=value1, Key2=value2"} - } - }); - hostingApplication.CreateContext(features); - Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName); - Assert.Equal(ActivityIdFormat.W3C, Activity.Current.IdFormat); - Assert.Equal("0123456789abcdef0123456789abcdef", Activity.Current.TraceId.ToHexString()); - Assert.Equal("0123456789abcdef", Activity.Current.ParentSpanId.ToHexString()); - Assert.Equal("TraceState1", Activity.Current.TraceStateString); - - Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key1" && pair.Value == "value1"); - Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key2" && pair.Value == "value2"); - } - - [Fact] - public void ActivityOnExportHookIsCalled() - { - var diagnosticListener = new DiagnosticListener("DummySource"); - var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener); - - bool onActivityImportCalled = false; - diagnosticListener.Subscribe( - observer: new CallbackDiagnosticListener(pair => { }), - isEnabled: (s, o, _) => true, - onActivityImport: (activity, context) => - { - onActivityImportCalled = true; - Assert.Null(Activity.Current); - Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", activity.OperationName); - Assert.NotNull(context); - Assert.IsAssignableFrom(context); - - activity.ActivityTraceFlags = ActivityTraceFlags.Recorded; - }); - - hostingApplication.CreateContext(features); - - Assert.True(onActivityImportCalled); - Assert.NotNull(Activity.Current); - Assert.True(Activity.Current.Recorded); - } - - - private static void AssertProperty(object o, string name) - { - Assert.NotNull(o); - var property = o.GetType().GetTypeInfo().GetProperty(name, BindingFlags.Instance | BindingFlags.Public); - Assert.NotNull(property); - var value = property.GetValue(o); - Assert.NotNull(value); - Assert.IsAssignableFrom(value); - } - - private static HostingApplication CreateApplication(out FeatureCollection features, - DiagnosticListener diagnosticListener = null, ILogger logger = null, Action configure = null) - { - var httpContextFactory = new Mock(); - - features = new FeatureCollection(); - features.Set(new HttpRequestFeature()); - var context = new DefaultHttpContext(features); - configure?.Invoke(context); - httpContextFactory.Setup(s => s.Create(It.IsAny())).Returns(context); - httpContextFactory.Setup(s => s.Dispose(It.IsAny())); + httpContextFactory ??= new DefaultHttpContextFactory(services.BuildServiceProvider()); var hostingApplication = new HostingApplication( ctx => Task.CompletedTask, - logger ?? new NullScopeLogger(), - diagnosticListener ?? new NoopDiagnosticListener(), - httpContextFactory.Object); + NullLogger.Instance, + new DiagnosticListener("Microsoft.AspNetCore"), + httpContextFactory); return hostingApplication; } - private class NullScopeLogger : ILogger + private class FeaturesWithContext : IHostContextContainer, IFeatureCollection { - private readonly bool _isEnabled; - public NullScopeLogger(bool isEnabled = false) + public FeaturesWithContext(IFeatureCollection features) { - _isEnabled = isEnabled; + Features = features; } - public IDisposable BeginScope(TState state) => null; + public IFeatureCollection Features { get; } - public bool IsEnabled(LogLevel logLevel) => _isEnabled; + public object this[Type key] { get => Features[key]; set => Features[key] = value; } - public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) - { - } - } + public T HostContext { get; set; } - private class LoggerWithScopes : ILogger - { - private readonly bool _isEnabled; - public LoggerWithScopes(bool isEnabled = false) - { - _isEnabled = isEnabled; - } + public bool IsReadOnly => Features.IsReadOnly; - public IDisposable BeginScope(TState state) - { - Scopes.Add(state); - return new Scope(); - } + public int Revision => Features.Revision; - public List Scopes { get; set; } = new List(); + public TFeature Get() => Features.Get(); - public bool IsEnabled(LogLevel logLevel) => _isEnabled; + public IEnumerator> GetEnumerator() => Features.GetEnumerator(); - public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) - { + public void Set(TFeature instance) => Features.Set(instance); - } - - private class Scope : IDisposable - { - public void Dispose() - { - } - } - } - - private class NoopDiagnosticListener : DiagnosticListener - { - private readonly bool _isEnabled; - - public NoopDiagnosticListener(bool isEnabled = false) : base("DummyListener") - { - _isEnabled = isEnabled; - } - - public override bool IsEnabled(string name) => _isEnabled; - - public override void Write(string name, object value) - { - } - } - - private class CallbackDiagnosticListener : IObserver> - { - private readonly Action> _callback; - - public CallbackDiagnosticListener(Action> callback) - { - _callback = callback; - } - - public void OnNext(KeyValuePair value) - { - _callback(value); - } - - public void OnError(Exception error) - { - } - - public void OnCompleted() - { - } + IEnumerator IEnumerable.GetEnumerator() => Features.GetEnumerator(); } } } diff --git a/src/Http/Http/src/DefaultHttpContext.cs b/src/Http/Http/src/DefaultHttpContext.cs index 102e96947d..7d096f186a 100644 --- a/src/Http/Http/src/DefaultHttpContext.cs +++ b/src/Http/Http/src/DefaultHttpContext.cs @@ -98,9 +98,9 @@ namespace Microsoft.AspNetCore.Http public override HttpResponse Response => _response; - public override ConnectionInfo Connection => _connection ?? (_connection = new DefaultConnectionInfo(_features.Collection)); + public override ConnectionInfo Connection => _connection ?? (_connection = new DefaultConnectionInfo(Features)); - public override WebSocketManager WebSockets => _websockets ?? (_websockets = new DefaultWebSocketManager(_features.Collection)); + public override WebSocketManager WebSockets => _websockets ?? (_websockets = new DefaultWebSocketManager(Features)); public override ClaimsPrincipal User { From 9098a47dbfede8c549633090fe931687a4e9ee8d Mon Sep 17 00:00:00 2001 From: David Fowler Date: Wed, 16 Oct 2019 22:04:29 -0700 Subject: [PATCH 02/24] Some minor clean up of Stream implementations (#14986) * Some minor clean up of Stream implementations - Use TaskToApm from corefx to implement Begin/End in streams - Use PipeReader.CopyToAsync(Stream) to implement CopyToAsync - Add more overrides on derived Streams in IIS --- src/Servers/IIS/IIS/src/Core/DuplexStream.cs | 20 +++ .../IIS/IIS/src/Core/HttpRequestStream.cs | 45 +++---- .../IIS/IIS/src/Core/HttpResponseStream.cs | 36 +----- .../IIS/IIS/src/Core/IISHttpContext.IO.cs | 13 +- .../Microsoft.AspNetCore.Server.IIS.csproj | 1 + .../src/Internal/Http/HttpRequestStream.cs | 80 ++---------- .../src/Internal/Http/HttpResponseStream.cs | 33 +---- ...soft.AspNetCore.Server.Kestrel.Core.csproj | 1 + .../Middleware/Internal/DuplexPipeStream.cs | 64 +-------- .../src/Middleware/Internal/LoggingStream.cs | 64 +-------- src/Shared/TaskToApm.cs | 121 ++++++++++++++++++ 11 files changed, 194 insertions(+), 284 deletions(-) create mode 100644 src/Shared/TaskToApm.cs diff --git a/src/Servers/IIS/IIS/src/Core/DuplexStream.cs b/src/Servers/IIS/IIS/src/Core/DuplexStream.cs index 8ff01c778f..73dbd4cbb9 100644 --- a/src/Servers/IIS/IIS/src/Core/DuplexStream.cs +++ b/src/Servers/IIS/IIS/src/Core/DuplexStream.cs @@ -60,9 +60,29 @@ namespace Microsoft.AspNetCore.Server.IIS.Core return _requestBody.ReadAsync(buffer, offset, count, cancellationToken); } + public override ValueTask ReadAsync(Memory buffer, CancellationToken cancellationToken = default) + { + return _requestBody.ReadAsync(buffer, cancellationToken); + } + public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { return _responseBody.WriteAsync(buffer, offset, count, cancellationToken); } + + public override ValueTask WriteAsync(ReadOnlyMemory buffer, CancellationToken cancellationToken = default) + { + return _responseBody.WriteAsync(buffer, cancellationToken); + } + + public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken) + { + return _requestBody.CopyToAsync(destination, bufferSize, cancellationToken); + } + + public override Task FlushAsync(CancellationToken cancellationToken) + { + return _responseBody.FlushAsync(cancellationToken); + } } } diff --git a/src/Servers/IIS/IIS/src/Core/HttpRequestStream.cs b/src/Servers/IIS/IIS/src/Core/HttpRequestStream.cs index 9fa5d7405e..8d90fd69a5 100644 --- a/src/Servers/IIS/IIS/src/Core/HttpRequestStream.cs +++ b/src/Servers/IIS/IIS/src/Core/HttpRequestStream.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.IO; using System.Runtime.ExceptionServices; using System.Threading; using System.Threading.Tasks; @@ -35,40 +36,12 @@ namespace Microsoft.AspNetCore.Server.IIS.Core public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state) { - var task = ReadAsync(buffer, offset, count, default(CancellationToken), state); - if (callback != null) - { - task.ContinueWith(t => callback.Invoke(t)); - } - return task; + return TaskToApm.Begin(ReadAsync(buffer, offset, count), callback, state); } public override int EndRead(IAsyncResult asyncResult) { - return ((Task)asyncResult).GetAwaiter().GetResult(); - } - - private Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken, object state) - { - var tcs = new TaskCompletionSource(state); - var task = ReadAsync(buffer, offset, count, cancellationToken); - task.ContinueWith((task2, state2) => - { - var tcs2 = (TaskCompletionSource)state2; - if (task2.IsCanceled) - { - tcs2.SetCanceled(); - } - else if (task2.IsFaulted) - { - tcs2.SetException(task2.Exception); - } - else - { - tcs2.SetResult(task2.Result); - } - }, tcs, cancellationToken); - return tcs.Task; + return TaskToApm.End(asyncResult); } public override Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) @@ -97,6 +70,18 @@ namespace Microsoft.AspNetCore.Server.IIS.Core } } + public override async Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken) + { + try + { + await _body.CopyToAsync(destination, cancellationToken); + } + catch (ConnectionAbortedException ex) + { + throw new TaskCanceledException("The request was aborted", ex); + } + } + public void StartAcceptingReads(IISHttpContext body) { // Only start if not aborted diff --git a/src/Servers/IIS/IIS/src/Core/HttpResponseStream.cs b/src/Servers/IIS/IIS/src/Core/HttpResponseStream.cs index 739b6b16f5..b1d0c1f22a 100644 --- a/src/Servers/IIS/IIS/src/Core/HttpResponseStream.cs +++ b/src/Servers/IIS/IIS/src/Core/HttpResponseStream.cs @@ -24,7 +24,7 @@ namespace Microsoft.AspNetCore.Server.IIS.Core public override void Flush() { - FlushAsync(default(CancellationToken)).GetAwaiter().GetResult(); + FlushAsync(default).GetAwaiter().GetResult(); } public override Task FlushAsync(CancellationToken cancellationToken) @@ -41,45 +41,17 @@ namespace Microsoft.AspNetCore.Server.IIS.Core throw new InvalidOperationException(CoreStrings.SynchronousWritesDisallowed); } - WriteAsync(buffer, offset, count, default(CancellationToken)).GetAwaiter().GetResult(); + WriteAsync(buffer, offset, count, default).GetAwaiter().GetResult(); } public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state) { - var task = WriteAsync(buffer, offset, count, default(CancellationToken), state); - if (callback != null) - { - task.ContinueWith(t => callback.Invoke(t)); - } - return task; + return TaskToApm.Begin(WriteAsync(buffer, offset, count), callback, state); } public override void EndWrite(IAsyncResult asyncResult) { - ((Task)asyncResult).GetAwaiter().GetResult(); - } - - private Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken, object state) - { - var tcs = new TaskCompletionSource(state); - var task = WriteAsync(buffer, offset, count, cancellationToken); - task.ContinueWith((task2, state2) => - { - var tcs2 = (TaskCompletionSource)state2; - if (task2.IsCanceled) - { - tcs2.SetCanceled(); - } - else if (task2.IsFaulted) - { - tcs2.SetException(task2.Exception); - } - else - { - tcs2.SetResult(null); - } - }, tcs, cancellationToken); - return tcs.Task; + TaskToApm.End(asyncResult); } public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) diff --git a/src/Servers/IIS/IIS/src/Core/IISHttpContext.IO.cs b/src/Servers/IIS/IIS/src/Core/IISHttpContext.IO.cs index 68141058c5..5f831eb01a 100644 --- a/src/Servers/IIS/IIS/src/Core/IISHttpContext.IO.cs +++ b/src/Servers/IIS/IIS/src/Core/IISHttpContext.IO.cs @@ -3,11 +3,10 @@ using System; using System.Buffers; -using System.Net.Http; +using System.IO; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Connections; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; namespace Microsoft.AspNetCore.Server.IIS.Core @@ -54,6 +53,16 @@ namespace Microsoft.AspNetCore.Server.IIS.Core } } + internal Task CopyToAsync(Stream destination, CancellationToken cancellationToken) + { + if (!HasStartedConsumingRequestBody) + { + InitializeRequestIO(); + } + + return _bodyInputPipe.Reader.CopyToAsync(destination, cancellationToken); + } + /// /// Writes data to the output pipe. /// diff --git a/src/Servers/IIS/IIS/src/Microsoft.AspNetCore.Server.IIS.csproj b/src/Servers/IIS/IIS/src/Microsoft.AspNetCore.Server.IIS.csproj index 06fe1aa203..a95e4ec56a 100644 --- a/src/Servers/IIS/IIS/src/Microsoft.AspNetCore.Server.IIS.csproj +++ b/src/Servers/IIS/IIS/src/Microsoft.AspNetCore.Server.IIS.csproj @@ -19,6 +19,7 @@ + diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/HttpRequestStream.cs b/src/Servers/Kestrel/Core/src/Internal/Http/HttpRequestStream.cs index 4d5513293e..a1b30fb940 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/HttpRequestStream.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/HttpRequestStream.cs @@ -90,41 +90,13 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state) { - var task = ReadAsync(buffer, offset, count, default, state); - if (callback != null) - { - task.ContinueWith(t => callback.Invoke(t)); - } - return task; + return TaskToApm.Begin(ReadAsync(buffer, offset, count), callback, state); } /// public override int EndRead(IAsyncResult asyncResult) { - return ((Task)asyncResult).GetAwaiter().GetResult(); - } - - private Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken, object state) - { - var tcs = new TaskCompletionSource(state); - var task = ReadAsync(buffer, offset, count, cancellationToken); - task.ContinueWith((task2, state2) => - { - var tcs2 = (TaskCompletionSource)state2; - if (task2.IsCanceled) - { - tcs2.SetCanceled(); - } - else if (task2.IsFaulted) - { - tcs2.SetException(task2.Exception); - } - else - { - tcs2.SetResult(task2.Result); - } - }, tcs, cancellationToken); - return tcs.Task; + return TaskToApm.End(asyncResult); } private ValueTask ReadAsyncWrapper(Memory destination, CancellationToken cancellationToken) @@ -139,7 +111,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http } } - private async ValueTask ReadAsyncInternal(Memory buffer, CancellationToken cancellationToken) + private async ValueTask ReadAsyncInternal(Memory destination, CancellationToken cancellationToken) { while (true) { @@ -150,19 +122,19 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http throw new OperationCanceledException("The read was canceled"); } - var readableBuffer = result.Buffer; - var readableBufferLength = readableBuffer.Length; + var buffer = result.Buffer; + var length = buffer.Length; - var consumed = readableBuffer.End; + var consumed = buffer.End; try { - if (readableBufferLength != 0) + if (length != 0) { - var actual = (int)Math.Min(readableBufferLength, buffer.Length); + var actual = (int)Math.Min(length, destination.Length); - var slice = actual == readableBufferLength ? readableBuffer : readableBuffer.Slice(0, actual); + var slice = actual == length ? buffer : buffer.Slice(0, actual); consumed = slice.End; - slice.CopyTo(buffer.Span); + slice.CopyTo(destination.Span); return actual; } @@ -193,37 +165,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http throw new ArgumentOutOfRangeException(nameof(bufferSize)); } - return CopyToAsyncInternal(destination, cancellationToken); - } - - private async Task CopyToAsyncInternal(Stream destination, CancellationToken cancellationToken) - { - while (true) - { - var result = await _pipeReader.ReadAsync(cancellationToken); - var readableBuffer = result.Buffer; - var readableBufferLength = readableBuffer.Length; - - try - { - if (readableBufferLength != 0) - { - foreach (var memory in readableBuffer) - { - await destination.WriteAsync(memory, cancellationToken); - } - } - - if (result.IsCompleted) - { - return; - } - } - finally - { - _pipeReader.AdvanceTo(readableBuffer.End); - } - } + return _pipeReader.CopyToAsync(destination, cancellationToken); } } } diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/HttpResponseStream.cs b/src/Servers/Kestrel/Core/src/Internal/Http/HttpResponseStream.cs index 2bf5017278..86ddb9b157 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/HttpResponseStream.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/HttpResponseStream.cs @@ -3,7 +3,6 @@ using System; using System.IO; -using System.IO.Pipelines; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Http.Features; @@ -87,40 +86,12 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state) { - var task = WriteAsync(buffer, offset, count, default, state); - if (callback != null) - { - task.ContinueWith(t => callback.Invoke(t)); - } - return task; + return TaskToApm.Begin(WriteAsync(buffer, offset, count), callback, state); } public override void EndWrite(IAsyncResult asyncResult) { - ((Task)asyncResult).GetAwaiter().GetResult(); - } - - private Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken, object state) - { - var tcs = new TaskCompletionSource(state); - var task = WriteAsync(buffer, offset, count, cancellationToken); - task.ContinueWith((task2, state2) => - { - var tcs2 = (TaskCompletionSource)state2; - if (task2.IsCanceled) - { - tcs2.SetCanceled(); - } - else if (task2.IsFaulted) - { - tcs2.SetException(task2.Exception); - } - else - { - tcs2.SetResult(null); - } - }, tcs, cancellationToken); - return tcs.Task; + TaskToApm.End(asyncResult); } public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) diff --git a/src/Servers/Kestrel/Core/src/Microsoft.AspNetCore.Server.Kestrel.Core.csproj b/src/Servers/Kestrel/Core/src/Microsoft.AspNetCore.Server.Kestrel.Core.csproj index ea3a87bad7..058df2190c 100644 --- a/src/Servers/Kestrel/Core/src/Microsoft.AspNetCore.Server.Kestrel.Core.csproj +++ b/src/Servers/Kestrel/Core/src/Microsoft.AspNetCore.Server.Kestrel.Core.csproj @@ -15,6 +15,7 @@ + diff --git a/src/Servers/Kestrel/Core/src/Middleware/Internal/DuplexPipeStream.cs b/src/Servers/Kestrel/Core/src/Middleware/Internal/DuplexPipeStream.cs index b81a5e8869..7a2dfdf362 100644 --- a/src/Servers/Kestrel/Core/src/Middleware/Internal/DuplexPipeStream.cs +++ b/src/Servers/Kestrel/Core/src/Middleware/Internal/DuplexPipeStream.cs @@ -152,78 +152,22 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state) { - var task = ReadAsync(buffer, offset, count, default, state); - if (callback != null) - { - task.ContinueWith(t => callback.Invoke(t)); - } - return task; + return TaskToApm.Begin(ReadAsync(buffer, offset, count), callback, state); } public override int EndRead(IAsyncResult asyncResult) { - return ((Task)asyncResult).GetAwaiter().GetResult(); - } - - private Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken, object state) - { - var tcs = new TaskCompletionSource(state); - var task = ReadAsync(buffer, offset, count, cancellationToken); - task.ContinueWith((task2, state2) => - { - var tcs2 = (TaskCompletionSource)state2; - if (task2.IsCanceled) - { - tcs2.SetCanceled(); - } - else if (task2.IsFaulted) - { - tcs2.SetException(task2.Exception); - } - else - { - tcs2.SetResult(task2.Result); - } - }, tcs, cancellationToken); - return tcs.Task; + return TaskToApm.End(asyncResult); } public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state) { - var task = WriteAsync(buffer, offset, count, default, state); - if (callback != null) - { - task.ContinueWith(t => callback.Invoke(t)); - } - return task; + return TaskToApm.Begin(WriteAsync(buffer, offset, count), callback, state); } public override void EndWrite(IAsyncResult asyncResult) { - ((Task)asyncResult).GetAwaiter().GetResult(); - } - - private Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken, object state) - { - var tcs = new TaskCompletionSource(state); - var task = WriteAsync(buffer, offset, count, cancellationToken); - task.ContinueWith((task2, state2) => - { - var tcs2 = (TaskCompletionSource)state2; - if (task2.IsCanceled) - { - tcs2.SetCanceled(); - } - else if (task2.IsFaulted) - { - tcs2.SetException(task2.Exception); - } - else - { - tcs2.SetResult(null); - } - }, tcs, cancellationToken); - return tcs.Task; + TaskToApm.End(asyncResult); } } } diff --git a/src/Servers/Kestrel/Core/src/Middleware/Internal/LoggingStream.cs b/src/Servers/Kestrel/Core/src/Middleware/Internal/LoggingStream.cs index e3fdec3f81..15758f64f4 100644 --- a/src/Servers/Kestrel/Core/src/Middleware/Internal/LoggingStream.cs +++ b/src/Servers/Kestrel/Core/src/Middleware/Internal/LoggingStream.cs @@ -176,78 +176,22 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal // The below APM methods call the underlying Read/WriteAsync methods which will still be logged. public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state) { - var task = ReadAsync(buffer, offset, count, default(CancellationToken), state); - if (callback != null) - { - task.ContinueWith(t => callback.Invoke(t)); - } - return task; + return TaskToApm.Begin(ReadAsync(buffer, offset, count), callback, state); } public override int EndRead(IAsyncResult asyncResult) { - return ((Task)asyncResult).GetAwaiter().GetResult(); - } - - private Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken, object state) - { - var tcs = new TaskCompletionSource(state); - var task = ReadAsync(buffer, offset, count, cancellationToken); - task.ContinueWith((task2, state2) => - { - var tcs2 = (TaskCompletionSource)state2; - if (task2.IsCanceled) - { - tcs2.SetCanceled(); - } - else if (task2.IsFaulted) - { - tcs2.SetException(task2.Exception); - } - else - { - tcs2.SetResult(task2.Result); - } - }, tcs, cancellationToken); - return tcs.Task; + return TaskToApm.End(asyncResult); } public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state) { - var task = WriteAsync(buffer, offset, count, default(CancellationToken), state); - if (callback != null) - { - task.ContinueWith(t => callback.Invoke(t)); - } - return task; + return TaskToApm.Begin(WriteAsync(buffer, offset, count), callback, state); } public override void EndWrite(IAsyncResult asyncResult) { - ((Task)asyncResult).GetAwaiter().GetResult(); - } - - private Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken, object state) - { - var tcs = new TaskCompletionSource(state); - var task = WriteAsync(buffer, offset, count, cancellationToken); - task.ContinueWith((task2, state2) => - { - var tcs2 = (TaskCompletionSource)state2; - if (task2.IsCanceled) - { - tcs2.SetCanceled(); - } - else if (task2.IsFaulted) - { - tcs2.SetException(task2.Exception); - } - else - { - tcs2.SetResult(null); - } - }, tcs, cancellationToken); - return tcs.Task; + TaskToApm.End(asyncResult); } } } diff --git a/src/Shared/TaskToApm.cs b/src/Shared/TaskToApm.cs new file mode 100644 index 0000000000..3a05eb6b42 --- /dev/null +++ b/src/Shared/TaskToApm.cs @@ -0,0 +1,121 @@ +// 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. + +// Helper methods for using Tasks to implement the APM pattern. +// +// Example usage, wrapping a Task-returning FooAsync method with Begin/EndFoo methods: +// +// public IAsyncResult BeginFoo(..., AsyncCallback callback, object state) => +// TaskToApm.Begin(FooAsync(...), callback, state); +// +// public int EndFoo(IAsyncResult asyncResult) => +// TaskToApm.End(asyncResult); + +#nullable enable +using System.Diagnostics; + +namespace System.Threading.Tasks +{ + /// + /// Provides support for efficiently using Tasks to implement the APM (Begin/End) pattern. + /// + internal static class TaskToApm + { + /// + /// Marshals the Task as an IAsyncResult, using the supplied callback and state + /// to implement the APM pattern. + /// + /// The Task to be marshaled. + /// The callback to be invoked upon completion. + /// The state to be stored in the IAsyncResult. + /// An IAsyncResult to represent the task's asynchronous operation. + public static IAsyncResult Begin(Task task, AsyncCallback? callback, object? state) => + new TaskAsyncResult(task, state, callback); + + /// Processes an IAsyncResult returned by Begin. + /// The IAsyncResult to unwrap. + public static void End(IAsyncResult asyncResult) + { + if (asyncResult is TaskAsyncResult twar) + { + twar._task.GetAwaiter().GetResult(); + return; + } + + throw new ArgumentNullException(); + } + + /// Processes an IAsyncResult returned by Begin. + /// The IAsyncResult to unwrap. + public static TResult End(IAsyncResult asyncResult) + { + if (asyncResult is TaskAsyncResult twar && twar._task is Task task) + { + return task.GetAwaiter().GetResult(); + } + + throw new ArgumentNullException(); + } + + /// Provides a simple IAsyncResult that wraps a Task. + /// + /// We could use the Task as the IAsyncResult if the Task's AsyncState is the same as the object state, + /// but that's very rare, in particular in a situation where someone cares about allocation, and always + /// using TaskAsyncResult simplifies things and enables additional optimizations. + /// + internal sealed class TaskAsyncResult : IAsyncResult + { + /// The wrapped Task. + internal readonly Task _task; + /// Callback to invoke when the wrapped task completes. + private readonly AsyncCallback? _callback; + + /// Initializes the IAsyncResult with the Task to wrap and the associated object state. + /// The Task to wrap. + /// The new AsyncState value. + /// Callback to invoke when the wrapped task completes. + internal TaskAsyncResult(Task task, object? state, AsyncCallback? callback) + { + Debug.Assert(task != null); + _task = task; + AsyncState = state; + + if (task.IsCompleted) + { + // Synchronous completion. Invoke the callback. No need to store it. + CompletedSynchronously = true; + callback?.Invoke(this); + } + else if (callback != null) + { + // Asynchronous completion, and we have a callback; schedule it. We use OnCompleted rather than ContinueWith in + // order to avoid running synchronously if the task has already completed by the time we get here but still run + // synchronously as part of the task's completion if the task completes after (the more common case). + _callback = callback; + _task.ConfigureAwait(continueOnCapturedContext: false) + .GetAwaiter() + .OnCompleted(InvokeCallback); // allocates a delegate, but avoids a closure + } + } + + /// Invokes the callback. + private void InvokeCallback() + { + Debug.Assert(!CompletedSynchronously); + Debug.Assert(_callback != null); + _callback.Invoke(this); + } + + /// Gets a user-defined object that qualifies or contains information about an asynchronous operation. + public object? AsyncState { get; } + /// Gets a value that indicates whether the asynchronous operation completed synchronously. + /// This is set lazily based on whether the has completed by the time this object is created. + public bool CompletedSynchronously { get; } + /// Gets a value that indicates whether the asynchronous operation has completed. + public bool IsCompleted => _task.IsCompleted; + /// Gets a that is used to wait for an asynchronous operation to complete. + public WaitHandle AsyncWaitHandle => ((IAsyncResult)_task).AsyncWaitHandle; + } + } +} \ No newline at end of file From bd65275148abc9b07a3b59797a88d485341152bf Mon Sep 17 00:00:00 2001 From: David Fowler Date: Wed, 16 Oct 2019 22:06:04 -0700 Subject: [PATCH 03/24] Update THIRD-PARTY-NOTICES.txt Add corefx to third party notices as part of https://github.com/aspnet/AspNetCore/pull/14986 --- THIRD-PARTY-NOTICES.txt | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/THIRD-PARTY-NOTICES.txt b/THIRD-PARTY-NOTICES.txt index 81fadeae22..99d1e37721 100644 --- a/THIRD-PARTY-NOTICES.txt +++ b/THIRD-PARTY-NOTICES.txt @@ -189,3 +189,31 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +License notice for corefx + +------------------------------------------------ + +The MIT License (MIT) + +Copyright (c) .NET Foundation and Contributors + +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From f651fdf1f190c6f203701cd6ee8a5a2d0ec14016 Mon Sep 17 00:00:00 2001 From: Kahbazi Date: Thu, 17 Oct 2019 16:16:20 +0330 Subject: [PATCH 04/24] Add AutomaticAuthentication option in HttpSys #5877 (#6516) --- ...ft.AspNetCore.Server.HttpSys.netcoreapp.cs | 1 + .../HttpSys/src/AuthenticationManager.cs | 10 ++++++ src/Servers/HttpSys/src/FeatureContext.cs | 6 +++- .../FunctionalTests/AuthenticationTests.cs | 32 +++++++++++++++++++ 4 files changed, 48 insertions(+), 1 deletion(-) diff --git a/src/Servers/HttpSys/ref/Microsoft.AspNetCore.Server.HttpSys.netcoreapp.cs b/src/Servers/HttpSys/ref/Microsoft.AspNetCore.Server.HttpSys.netcoreapp.cs index f25f75f41f..642c31fc91 100644 --- a/src/Servers/HttpSys/ref/Microsoft.AspNetCore.Server.HttpSys.netcoreapp.cs +++ b/src/Servers/HttpSys/ref/Microsoft.AspNetCore.Server.HttpSys.netcoreapp.cs @@ -15,6 +15,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys { internal AuthenticationManager() { } public bool AllowAnonymous { get { throw null; } set { } } + public bool AutomaticAuthentication { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public Microsoft.AspNetCore.Server.HttpSys.AuthenticationSchemes Schemes { get { throw null; } set { } } } [System.FlagsAttribute] diff --git a/src/Servers/HttpSys/src/AuthenticationManager.cs b/src/Servers/HttpSys/src/AuthenticationManager.cs index 29f5a3495a..9b54f0ab0f 100644 --- a/src/Servers/HttpSys/src/AuthenticationManager.cs +++ b/src/Servers/HttpSys/src/AuthenticationManager.cs @@ -45,12 +45,22 @@ namespace Microsoft.AspNetCore.Server.HttpSys } } + /// + /// Indicates if anonymous requests will be surfaced to the application or challenged by the server. + /// The default value is true. + /// public bool AllowAnonymous { get { return _allowAnonymous; } set { _allowAnonymous = value; } } + /// + /// If true the server should set HttpContext.User. If false the server will only provide an + /// identity when explicitly requested by the AuthenticationScheme. The default is true. + /// + public bool AutomaticAuthentication { get; set; } = true; + internal void SetUrlGroupSecurity(UrlGroup urlGroup) { Debug.Assert(_urlGroup == null, "SetUrlGroupSecurity called more than once."); diff --git a/src/Servers/HttpSys/src/FeatureContext.cs b/src/Servers/HttpSys/src/FeatureContext.cs index d2e2626874..cb0ba885b0 100644 --- a/src/Servers/HttpSys/src/FeatureContext.cs +++ b/src/Servers/HttpSys/src/FeatureContext.cs @@ -85,7 +85,11 @@ namespace Microsoft.AspNetCore.Server.HttpSys _query = Request.QueryString; _rawTarget = Request.RawUrl; _scheme = Request.Scheme; - _user = _requestContext.User; + + if (requestContext.Server.Options.Authentication.AutomaticAuthentication) + { + _user = _requestContext.User; + } _responseStream = new ResponseStream(requestContext.Response.Body, OnResponseStart); _responseHeaders = Response.Headers; diff --git a/src/Servers/HttpSys/test/FunctionalTests/AuthenticationTests.cs b/src/Servers/HttpSys/test/FunctionalTests/AuthenticationTests.cs index be66db9655..2886b2d8d1 100644 --- a/src/Servers/HttpSys/test/FunctionalTests/AuthenticationTests.cs +++ b/src/Servers/HttpSys/test/FunctionalTests/AuthenticationTests.cs @@ -368,6 +368,38 @@ namespace Microsoft.AspNetCore.Server.HttpSys } } + [ConditionalTheory] + [InlineData(AuthenticationSchemes.Negotiate)] + [InlineData(AuthenticationSchemes.NTLM)] + // [InlineData(AuthenticationSchemes.Digest)] // TODO: Not implemented + // [InlineData(AuthenticationSchemes.Basic)] // Doesn't work with default creds + [InlineData(AuthenticationSchemes.Negotiate | AuthenticationSchemes.NTLM | /* AuthenticationSchemes.Digest |*/ AuthenticationSchemes.Basic)] + public async Task AuthTypes_DisableAutomaticAuthentication(AuthenticationSchemes authType) + { + using (var server = Utilities.CreateDynamicHost(out var address, options => + { + options.Authentication.AutomaticAuthentication = false; + options.Authentication.Schemes = authType; + options.Authentication.AllowAnonymous = DenyAnoymous; + }, + async httpContext => + { + Assert.NotNull(httpContext.User); + Assert.NotNull(httpContext.User.Identity); + Assert.False(httpContext.User.Identity.IsAuthenticated); + + var authenticateResult = await httpContext.AuthenticateAsync(HttpSysDefaults.AuthenticationScheme); + + Assert.NotNull(authenticateResult.Principal); + Assert.NotNull(authenticateResult.Principal.Identity); + Assert.True(authenticateResult.Principal.Identity.IsAuthenticated); + })) + { + var response = await SendRequestAsync(address, useDefaultCredentials: true); + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + } + } + private async Task SendRequestAsync(string uri, bool useDefaultCredentials = false) { HttpClientHandler handler = new HttpClientHandler(); From 1eebef11fac6a4ca9d0ea581e0ff27262026fa0d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 17 Oct 2019 14:20:10 +0000 Subject: [PATCH 05/24] [master] Update dependencies from 2 repositories (#15057) * Update dependencies from https://github.com/aspnet/AspNetCore-Tooling build 20191015.1 - Microsoft.AspNetCore.Mvc.Razor.Extensions - 5.0.0-alpha1.19515.1 - Microsoft.AspNetCore.Razor.Language - 5.0.0-alpha1.19515.1 - Microsoft.CodeAnalysis.Razor - 5.0.0-alpha1.19515.1 - Microsoft.NET.Sdk.Razor - 5.0.0-alpha1.19515.1 * Update dependencies from https://github.com/aspnet/EntityFrameworkCore build 20191016.4 - Microsoft.EntityFrameworkCore.Tools - 5.0.0-alpha1.19516.4 - Microsoft.EntityFrameworkCore.SqlServer - 5.0.0-alpha1.19516.4 - dotnet-ef - 5.0.0-alpha1.19516.4 - Microsoft.EntityFrameworkCore - 5.0.0-alpha1.19516.4 - Microsoft.EntityFrameworkCore.InMemory - 5.0.0-alpha1.19516.4 - Microsoft.EntityFrameworkCore.Relational - 5.0.0-alpha1.19516.4 - Microsoft.EntityFrameworkCore.Sqlite - 5.0.0-alpha1.19516.4 --- eng/Version.Details.xml | 44 ++++++++++++++++++++--------------------- eng/Versions.props | 22 ++++++++++----------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e465c078ce..fc9d252e34 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -13,49 +13,49 @@ https://github.com/aspnet/Blazor adc2dc6547bc542aa687c712e0e3c0e5de3500fe - + https://github.com/aspnet/AspNetCore-Tooling - debe2d2e911020ffee5d6e95eb4dc6d0754bd8ef + 9a8b07ac0b544bbc3cb69cf157383ce6b60eb570 - + https://github.com/aspnet/AspNetCore-Tooling - debe2d2e911020ffee5d6e95eb4dc6d0754bd8ef + 9a8b07ac0b544bbc3cb69cf157383ce6b60eb570 - + https://github.com/aspnet/AspNetCore-Tooling - debe2d2e911020ffee5d6e95eb4dc6d0754bd8ef + 9a8b07ac0b544bbc3cb69cf157383ce6b60eb570 - + https://github.com/aspnet/AspNetCore-Tooling - debe2d2e911020ffee5d6e95eb4dc6d0754bd8ef + 9a8b07ac0b544bbc3cb69cf157383ce6b60eb570 - + https://github.com/aspnet/EntityFrameworkCore - 2da52082db1fb33f785822c560f2373e691bab0c + 3ff22d6bb91fc61901fabda7dd0ff5b22585fb1b - + https://github.com/aspnet/EntityFrameworkCore - 2da52082db1fb33f785822c560f2373e691bab0c + 3ff22d6bb91fc61901fabda7dd0ff5b22585fb1b - + https://github.com/aspnet/EntityFrameworkCore - 2da52082db1fb33f785822c560f2373e691bab0c + 3ff22d6bb91fc61901fabda7dd0ff5b22585fb1b - + https://github.com/aspnet/EntityFrameworkCore - 2da52082db1fb33f785822c560f2373e691bab0c + 3ff22d6bb91fc61901fabda7dd0ff5b22585fb1b - + https://github.com/aspnet/EntityFrameworkCore - 2da52082db1fb33f785822c560f2373e691bab0c + 3ff22d6bb91fc61901fabda7dd0ff5b22585fb1b - + https://github.com/aspnet/EntityFrameworkCore - 2da52082db1fb33f785822c560f2373e691bab0c + 3ff22d6bb91fc61901fabda7dd0ff5b22585fb1b - + https://github.com/aspnet/EntityFrameworkCore - 2da52082db1fb33f785822c560f2373e691bab0c + 3ff22d6bb91fc61901fabda7dd0ff5b22585fb1b https://github.com/aspnet/Extensions diff --git a/eng/Versions.props b/eng/Versions.props index 57d9d3ba42..836eb8b6ee 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -153,18 +153,18 @@ 5.0.0-alpha1.19514.8 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19515.8 - 5.0.0-alpha1.19515.8 - 5.0.0-alpha1.19515.8 - 5.0.0-alpha1.19515.8 - 5.0.0-alpha1.19515.8 - 5.0.0-alpha1.19515.8 - 5.0.0-alpha1.19515.8 + 5.0.0-alpha1.19516.4 + 5.0.0-alpha1.19516.4 + 5.0.0-alpha1.19516.4 + 5.0.0-alpha1.19516.4 + 5.0.0-alpha1.19516.4 + 5.0.0-alpha1.19516.4 + 5.0.0-alpha1.19516.4 - 5.0.0-alpha1.19513.1 - 5.0.0-alpha1.19513.1 - 5.0.0-alpha1.19513.1 - 5.0.0-alpha1.19513.1 + 5.0.0-alpha1.19515.1 + 5.0.0-alpha1.19515.1 + 5.0.0-alpha1.19515.1 + 5.0.0-alpha1.19515.1 - + https://github.com/aspnet/Blazor - adc2dc6547bc542aa687c712e0e3c0e5de3500fe + af9bec917415a00716551608d734ddb1b729eb2b https://github.com/aspnet/AspNetCore-Tooling diff --git a/eng/Versions.props b/eng/Versions.props index 836eb8b6ee..5ad0622206 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -89,7 +89,7 @@ 5.0.0-alpha1.19504.7 - 5.0.0-alpha1.19514.2 + 5.0.0-alpha1.19516.2 5.0.0-alpha1.19514.8 5.0.0-alpha1.19514.8 From 23f3a10965fb70b1ae34c5464d497c71540c998e Mon Sep 17 00:00:00 2001 From: Brennan Date: Thu, 17 Oct 2019 11:27:03 -0700 Subject: [PATCH 07/24] [TS Client] Catch exception in onreceive and close connection (#15082) --- .../ts/signalr/src/WebSocketTransport.ts | 17 +++++++++-- .../signalr/tests/WebSocketTransport.test.ts | 30 +++++++++++++++++++ 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/src/SignalR/clients/ts/signalr/src/WebSocketTransport.ts b/src/SignalR/clients/ts/signalr/src/WebSocketTransport.ts index 7383725ef1..1354a7e72d 100644 --- a/src/SignalR/clients/ts/signalr/src/WebSocketTransport.ts +++ b/src/SignalR/clients/ts/signalr/src/WebSocketTransport.ts @@ -96,7 +96,12 @@ export class WebSocketTransport implements ITransport { webSocket.onmessage = (message: MessageEvent) => { this.logger.log(LogLevel.Trace, `(WebSockets transport) data received. ${getDataDetail(message.data, this.logMessageContent)}.`); if (this.onreceive) { - this.onreceive(message.data); + try { + this.onreceive(message.data); + } catch (error) { + this.close(error); + return; + } } }; @@ -131,15 +136,21 @@ export class WebSocketTransport implements ITransport { return Promise.resolve(); } - private close(event?: CloseEvent): void { + private close(event?: CloseEvent | Error): void { // webSocket will be null if the transport did not start successfully this.logger.log(LogLevel.Trace, "(WebSockets transport) socket closed."); if (this.onclose) { - if (event && (event.wasClean === false || event.code !== 1000)) { + if (this.isCloseEvent(event) && (event.wasClean === false || event.code !== 1000)) { this.onclose(new Error(`WebSocket closed with status code: ${event.code} (${event.reason}).`)); + } else if (event instanceof Error) { + this.onclose(event); } else { this.onclose(); } } } + + private isCloseEvent(event?: any): event is CloseEvent { + return event && typeof event.wasClean === "boolean" && typeof event.code === "number"; + } } diff --git a/src/SignalR/clients/ts/signalr/tests/WebSocketTransport.test.ts b/src/SignalR/clients/ts/signalr/tests/WebSocketTransport.test.ts index 4ac43fe966..7fae4c65ae 100644 --- a/src/SignalR/clients/ts/signalr/tests/WebSocketTransport.test.ts +++ b/src/SignalR/clients/ts/signalr/tests/WebSocketTransport.test.ts @@ -229,6 +229,36 @@ describe("WebSocketTransport", () => { .toBe("WebSocket is not in the OPEN state"); }); }); + + it("is closed from 'onreceive' callback throwing", async () => { + await VerifyLogger.run(async (logger) => { + (global as any).ErrorEvent = TestEvent; + const webSocket = await createAndStartWebSocket(logger); + + let closeCalled: boolean = false; + let error: Error; + webSocket.onclose = (e) => { + closeCalled = true; + error = e!; + }; + + const receiveError = new Error("callback error"); + webSocket.onreceive = (data) => { + throw receiveError; + }; + + const message = new TestMessageEvent(); + message.data = "receive data"; + TestWebSocket.webSocket.onmessage(message); + + expect(closeCalled).toBe(true); + expect(error!).toBe(receiveError); + + await expect(webSocket.send("")) + .rejects + .toBe("WebSocket is not in the OPEN state"); + }); + }); }); async function createAndStartWebSocket(logger: ILogger, url?: string, accessTokenFactory?: (() => string | Promise), format?: TransferFormat): Promise { From 4dd9bfc492452174f9329c3e1fc4807cb393c05a Mon Sep 17 00:00:00 2001 From: Chris Ross Date: Thu, 17 Oct 2019 13:40:08 -0700 Subject: [PATCH 08/24] Prevent modifying ContentLength after starting response #14056 (#15089) --- .../Kestrel/Core/src/Internal/Http/HttpHeaders.cs | 4 ++++ .../Kestrel/Core/test/HttpResponseHeadersTests.cs | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/HttpHeaders.cs b/src/Servers/Kestrel/Core/src/Internal/Http/HttpHeaders.cs index d041705a19..e1175fcde9 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/HttpHeaders.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/HttpHeaders.cs @@ -27,6 +27,10 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http get { return _contentLength; } set { + if (_isReadOnly) + { + ThrowHeadersReadOnlyException(); + } if (value.HasValue && value.Value < 0) { ThrowInvalidContentLengthException(value.Value); diff --git a/src/Servers/Kestrel/Core/test/HttpResponseHeadersTests.cs b/src/Servers/Kestrel/Core/test/HttpResponseHeadersTests.cs index ed3c492e3c..1bbe06e99c 100644 --- a/src/Servers/Kestrel/Core/test/HttpResponseHeadersTests.cs +++ b/src/Servers/Kestrel/Core/test/HttpResponseHeadersTests.cs @@ -138,6 +138,15 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests Assert.Throws(() => ((IDictionary)headers).Add("my-header", new[] { "value" })); } + [Fact] + public void ThrowsWhenSettingContentLengthPropertyAfterReadOnlyIsSet() + { + var headers = new HttpResponseHeaders(); + headers.SetReadOnly(); + + Assert.Throws(() => headers.ContentLength = null); + } + [Fact] public void ThrowsWhenChangingHeaderAfterReadOnlyIsSet() { From a4d9faefe2ed6fbebd500413032336607ec92778 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 18 Oct 2019 13:50:22 +0000 Subject: [PATCH 09/24] Update dependencies from https://github.com/aspnet/EntityFrameworkCore build 20191017.14 (#15147) - Microsoft.EntityFrameworkCore.Tools - 5.0.0-alpha1.19517.14 - Microsoft.EntityFrameworkCore.SqlServer - 5.0.0-alpha1.19517.14 - dotnet-ef - 5.0.0-alpha1.19517.14 - Microsoft.EntityFrameworkCore - 5.0.0-alpha1.19517.14 - Microsoft.EntityFrameworkCore.InMemory - 5.0.0-alpha1.19517.14 - Microsoft.EntityFrameworkCore.Relational - 5.0.0-alpha1.19517.14 - Microsoft.EntityFrameworkCore.Sqlite - 5.0.0-alpha1.19517.14 Dependency coherency updates - Microsoft.AspNetCore.Analyzer.Testing - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.AspNetCore.BenchmarkRunner.Sources - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.ActivatorUtilities.Sources - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Caching.Abstractions - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Caching.Memory - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Caching.SqlServer - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Caching.StackExchangeRedis - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.CommandLineUtils.Sources - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Configuration.Abstractions - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Configuration.AzureKeyVault - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Configuration.Binder - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Configuration.CommandLine - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Configuration.EnvironmentVariables - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Configuration.FileExtensions - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Configuration.Ini - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Configuration.Json - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Configuration.KeyPerFile - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Configuration.UserSecrets - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Configuration.Xml - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Configuration - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.DependencyInjection.Abstractions - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.DependencyInjection - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.DiagnosticAdapter - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Diagnostics.HealthChecks - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.FileProviders.Abstractions - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.FileProviders.Composite - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.FileProviders.Embedded - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.FileProviders.Physical - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.FileSystemGlobbing - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.HashCodeCombiner.Sources - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Hosting.Abstractions - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Hosting - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.HostFactoryResolver.Sources - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Http - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Localization.Abstractions - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Localization - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Logging.Abstractions - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Logging.AzureAppServices - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Logging.Configuration - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Logging.Console - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Logging.Debug - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Logging.EventSource - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Logging.EventLog - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Logging.TraceSource - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Logging.Testing - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.ObjectPool - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Options.ConfigurationExtensions - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Options.DataAnnotations - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Options - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.ParameterDefaultValue.Sources - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.Primitives - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.TypeNameHelper.Sources - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.ValueStopwatch.Sources - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.WebEncoders - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Internal.Extensions.Refs - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.JSInterop - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Mono.WebAssembly.Interop - 5.0.0-preview2.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.NETCore.App.Runtime.win-x64 - 5.0.0-alpha1.19515.17 (parent: Microsoft.Extensions.Logging) - Microsoft.Extensions.Logging - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.Extensions.DependencyModel - 5.0.0-alpha1.19515.17 (parent: Microsoft.Extensions.Logging) - Microsoft.NETCore.App.Ref - 5.0.0-alpha1.19515.17 (parent: Microsoft.Extensions.Logging) - NETStandard.Library.Ref - 2.1.0-alpha1.19515.17 (parent: Microsoft.Extensions.Logging) - Internal.AspNetCore.Analyzers - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) - Microsoft.AspNetCore.Testing - 5.0.0-alpha1.19516.2 (parent: Microsoft.EntityFrameworkCore) --- eng/Version.Details.xml | 288 ++++++++++++++++++++-------------------- eng/Versions.props | 144 ++++++++++---------- 2 files changed, 216 insertions(+), 216 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 65269faf8c..fd8a68ecfd 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -29,269 +29,269 @@ https://github.com/aspnet/AspNetCore-Tooling 9a8b07ac0b544bbc3cb69cf157383ce6b60eb570 - + https://github.com/aspnet/EntityFrameworkCore - 3ff22d6bb91fc61901fabda7dd0ff5b22585fb1b + b9a36b4bc2431d496fc59bcdf4df54dae84d3958 - + https://github.com/aspnet/EntityFrameworkCore - 3ff22d6bb91fc61901fabda7dd0ff5b22585fb1b + b9a36b4bc2431d496fc59bcdf4df54dae84d3958 - + https://github.com/aspnet/EntityFrameworkCore - 3ff22d6bb91fc61901fabda7dd0ff5b22585fb1b + b9a36b4bc2431d496fc59bcdf4df54dae84d3958 - + https://github.com/aspnet/EntityFrameworkCore - 3ff22d6bb91fc61901fabda7dd0ff5b22585fb1b + b9a36b4bc2431d496fc59bcdf4df54dae84d3958 - + https://github.com/aspnet/EntityFrameworkCore - 3ff22d6bb91fc61901fabda7dd0ff5b22585fb1b + b9a36b4bc2431d496fc59bcdf4df54dae84d3958 - + https://github.com/aspnet/EntityFrameworkCore - 3ff22d6bb91fc61901fabda7dd0ff5b22585fb1b + b9a36b4bc2431d496fc59bcdf4df54dae84d3958 - + https://github.com/aspnet/EntityFrameworkCore - 3ff22d6bb91fc61901fabda7dd0ff5b22585fb1b + b9a36b4bc2431d496fc59bcdf4df54dae84d3958 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 https://github.com/dotnet/corefx @@ -381,25 +381,25 @@ https://github.com/dotnet/corefx a434a52ae3f1175bc1cad8b1a02b0921ef3b1f55 - + https://github.com/dotnet/core-setup - 4ace84dbf94128b4825c76cdd09b46dba7473478 + 0ceceab994c8e965bf50b11fc230dc2ea67aa1ec - + https://github.com/dotnet/core-setup - 4ace84dbf94128b4825c76cdd09b46dba7473478 + 0ceceab994c8e965bf50b11fc230dc2ea67aa1ec - + https://github.com/dotnet/core-setup - 4ace84dbf94128b4825c76cdd09b46dba7473478 + 0ceceab994c8e965bf50b11fc230dc2ea67aa1ec - + https://github.com/dotnet/core-setup - 4ace84dbf94128b4825c76cdd09b46dba7473478 + 0ceceab994c8e965bf50b11fc230dc2ea67aa1ec @@ -408,9 +408,9 @@ https://github.com/dotnet/corefx a434a52ae3f1175bc1cad8b1a02b0921ef3b1f55 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 https://github.com/dotnet/arcade @@ -424,9 +424,9 @@ https://github.com/dotnet/arcade f8546fbab59a74a66c83b8cb76b3f6877ce1d374 - + https://github.com/aspnet/Extensions - 5fb4eb52033b15dea5a4165fb7ce15f6bee83cf0 + 66007df6e5b68683de0cab0dc6a8552265318f20 https://github.com/dotnet/roslyn diff --git a/eng/Versions.props b/eng/Versions.props index 5ad0622206..a3c1adecb2 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -59,10 +59,10 @@ 3.4.0-beta1-19456-03 - 5.0.0-alpha1.19514.1 - 5.0.0-alpha1.19514.1 - 5.0.0-alpha1.19514.1 - 2.1.0-alpha1.19514.1 + 5.0.0-alpha1.19515.17 + 5.0.0-alpha1.19515.17 + 5.0.0-alpha1.19515.17 + 2.1.0-alpha1.19515.17 1.2.0-alpha1.19504.7 5.0.0-alpha1.19504.7 @@ -91,75 +91,75 @@ 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 - 5.0.0-alpha1.19514.8 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-alpha1.19516.2 + 5.0.0-preview2.19516.2 - 5.0.0-alpha1.19516.4 - 5.0.0-alpha1.19516.4 - 5.0.0-alpha1.19516.4 - 5.0.0-alpha1.19516.4 - 5.0.0-alpha1.19516.4 - 5.0.0-alpha1.19516.4 - 5.0.0-alpha1.19516.4 + 5.0.0-alpha1.19517.14 + 5.0.0-alpha1.19517.14 + 5.0.0-alpha1.19517.14 + 5.0.0-alpha1.19517.14 + 5.0.0-alpha1.19517.14 + 5.0.0-alpha1.19517.14 + 5.0.0-alpha1.19517.14 5.0.0-alpha1.19515.1 5.0.0-alpha1.19515.1 From 19b964465615d90f4e67ef145f543a00fdcab25a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 19 Oct 2019 01:11:27 +0000 Subject: [PATCH 10/24] Update dependencies from https://github.com/aspnet/AspNetCore-Tooling build 20191017.12 (#15149) - Microsoft.AspNetCore.Mvc.Razor.Extensions - 5.0.0-alpha1.19517.12 - Microsoft.AspNetCore.Razor.Language - 5.0.0-alpha1.19517.12 - Microsoft.CodeAnalysis.Razor - 5.0.0-alpha1.19517.12 - Microsoft.NET.Sdk.Razor - 5.0.0-alpha1.19517.12 --- eng/Version.Details.xml | 16 ++++++++-------- eng/Versions.props | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index fd8a68ecfd..eef6ef64c5 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -13,21 +13,21 @@ https://github.com/aspnet/Blazor af9bec917415a00716551608d734ddb1b729eb2b - + https://github.com/aspnet/AspNetCore-Tooling - 9a8b07ac0b544bbc3cb69cf157383ce6b60eb570 + 5d3c4074fe2df12afefab2292e4644b4f2686b29 - + https://github.com/aspnet/AspNetCore-Tooling - 9a8b07ac0b544bbc3cb69cf157383ce6b60eb570 + 5d3c4074fe2df12afefab2292e4644b4f2686b29 - + https://github.com/aspnet/AspNetCore-Tooling - 9a8b07ac0b544bbc3cb69cf157383ce6b60eb570 + 5d3c4074fe2df12afefab2292e4644b4f2686b29 - + https://github.com/aspnet/AspNetCore-Tooling - 9a8b07ac0b544bbc3cb69cf157383ce6b60eb570 + 5d3c4074fe2df12afefab2292e4644b4f2686b29 https://github.com/aspnet/EntityFrameworkCore diff --git a/eng/Versions.props b/eng/Versions.props index a3c1adecb2..3f451add81 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -161,10 +161,10 @@ 5.0.0-alpha1.19517.14 5.0.0-alpha1.19517.14 - 5.0.0-alpha1.19515.1 - 5.0.0-alpha1.19515.1 - 5.0.0-alpha1.19515.1 - 5.0.0-alpha1.19515.1 + 5.0.0-alpha1.19517.12 + 5.0.0-alpha1.19517.12 + 5.0.0-alpha1.19517.12 + 5.0.0-alpha1.19517.12 + + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index eef6ef64c5..e5d7cfda76 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -29,388 +29,388 @@ https://github.com/aspnet/AspNetCore-Tooling 5d3c4074fe2df12afefab2292e4644b4f2686b29 - + https://github.com/aspnet/EntityFrameworkCore - b9a36b4bc2431d496fc59bcdf4df54dae84d3958 + 717c0693868642f1dae589f765d775dbc881cf7d - + https://github.com/aspnet/EntityFrameworkCore - b9a36b4bc2431d496fc59bcdf4df54dae84d3958 + 717c0693868642f1dae589f765d775dbc881cf7d - + https://github.com/aspnet/EntityFrameworkCore - b9a36b4bc2431d496fc59bcdf4df54dae84d3958 + 717c0693868642f1dae589f765d775dbc881cf7d - + https://github.com/aspnet/EntityFrameworkCore - b9a36b4bc2431d496fc59bcdf4df54dae84d3958 + 717c0693868642f1dae589f765d775dbc881cf7d - + https://github.com/aspnet/EntityFrameworkCore - b9a36b4bc2431d496fc59bcdf4df54dae84d3958 + 717c0693868642f1dae589f765d775dbc881cf7d - + https://github.com/aspnet/EntityFrameworkCore - b9a36b4bc2431d496fc59bcdf4df54dae84d3958 + 717c0693868642f1dae589f765d775dbc881cf7d - + https://github.com/aspnet/EntityFrameworkCore - b9a36b4bc2431d496fc59bcdf4df54dae84d3958 + 717c0693868642f1dae589f765d775dbc881cf7d - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e - + https://github.com/dotnet/corefx - a434a52ae3f1175bc1cad8b1a02b0921ef3b1f55 + 4ac4c0367003fe3973a3648eb0715ddb0e3bbcea - + https://github.com/dotnet/corefx - a434a52ae3f1175bc1cad8b1a02b0921ef3b1f55 + b9186cfa3566ee24e5f16e45c542a3078e128dc6 - + https://github.com/dotnet/corefx - a434a52ae3f1175bc1cad8b1a02b0921ef3b1f55 + b9186cfa3566ee24e5f16e45c542a3078e128dc6 - + https://github.com/dotnet/corefx - a434a52ae3f1175bc1cad8b1a02b0921ef3b1f55 + b9186cfa3566ee24e5f16e45c542a3078e128dc6 - + https://github.com/dotnet/corefx - a434a52ae3f1175bc1cad8b1a02b0921ef3b1f55 + b9186cfa3566ee24e5f16e45c542a3078e128dc6 - + https://github.com/dotnet/corefx - a434a52ae3f1175bc1cad8b1a02b0921ef3b1f55 + b9186cfa3566ee24e5f16e45c542a3078e128dc6 - + https://github.com/dotnet/corefx - a434a52ae3f1175bc1cad8b1a02b0921ef3b1f55 + b9186cfa3566ee24e5f16e45c542a3078e128dc6 - + https://github.com/dotnet/corefx - a434a52ae3f1175bc1cad8b1a02b0921ef3b1f55 + b9186cfa3566ee24e5f16e45c542a3078e128dc6 - + https://github.com/dotnet/corefx - a434a52ae3f1175bc1cad8b1a02b0921ef3b1f55 + b9186cfa3566ee24e5f16e45c542a3078e128dc6 - + https://github.com/dotnet/corefx - a434a52ae3f1175bc1cad8b1a02b0921ef3b1f55 + b9186cfa3566ee24e5f16e45c542a3078e128dc6 - + https://github.com/dotnet/corefx - a434a52ae3f1175bc1cad8b1a02b0921ef3b1f55 + b9186cfa3566ee24e5f16e45c542a3078e128dc6 - + https://github.com/dotnet/corefx - a434a52ae3f1175bc1cad8b1a02b0921ef3b1f55 + b9186cfa3566ee24e5f16e45c542a3078e128dc6 - + https://github.com/dotnet/corefx - a434a52ae3f1175bc1cad8b1a02b0921ef3b1f55 + b9186cfa3566ee24e5f16e45c542a3078e128dc6 - + https://github.com/dotnet/corefx - a434a52ae3f1175bc1cad8b1a02b0921ef3b1f55 + b9186cfa3566ee24e5f16e45c542a3078e128dc6 - + https://github.com/dotnet/corefx - a434a52ae3f1175bc1cad8b1a02b0921ef3b1f55 + b9186cfa3566ee24e5f16e45c542a3078e128dc6 - + https://github.com/dotnet/corefx - a434a52ae3f1175bc1cad8b1a02b0921ef3b1f55 + b9186cfa3566ee24e5f16e45c542a3078e128dc6 - + https://github.com/dotnet/corefx - a434a52ae3f1175bc1cad8b1a02b0921ef3b1f55 + b9186cfa3566ee24e5f16e45c542a3078e128dc6 - + https://github.com/dotnet/corefx - a434a52ae3f1175bc1cad8b1a02b0921ef3b1f55 + b9186cfa3566ee24e5f16e45c542a3078e128dc6 - + https://github.com/dotnet/corefx - a434a52ae3f1175bc1cad8b1a02b0921ef3b1f55 + b9186cfa3566ee24e5f16e45c542a3078e128dc6 - + https://github.com/dotnet/corefx - a434a52ae3f1175bc1cad8b1a02b0921ef3b1f55 + b9186cfa3566ee24e5f16e45c542a3078e128dc6 - + https://github.com/dotnet/corefx - a434a52ae3f1175bc1cad8b1a02b0921ef3b1f55 + b9186cfa3566ee24e5f16e45c542a3078e128dc6 - + https://github.com/dotnet/corefx - a434a52ae3f1175bc1cad8b1a02b0921ef3b1f55 + b9186cfa3566ee24e5f16e45c542a3078e128dc6 - + https://github.com/dotnet/core-setup - 0ceceab994c8e965bf50b11fc230dc2ea67aa1ec + a484aa78e137262669266591696fe188ca2b5d63 - + https://github.com/dotnet/core-setup - 0ceceab994c8e965bf50b11fc230dc2ea67aa1ec + a484aa78e137262669266591696fe188ca2b5d63 - + https://github.com/dotnet/core-setup - 0ceceab994c8e965bf50b11fc230dc2ea67aa1ec + a484aa78e137262669266591696fe188ca2b5d63 - + https://github.com/dotnet/core-setup - 0ceceab994c8e965bf50b11fc230dc2ea67aa1ec + a484aa78e137262669266591696fe188ca2b5d63 - + https://github.com/dotnet/corefx - a434a52ae3f1175bc1cad8b1a02b0921ef3b1f55 + b9186cfa3566ee24e5f16e45c542a3078e128dc6 - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e https://github.com/dotnet/arcade @@ -424,9 +424,9 @@ https://github.com/dotnet/arcade f8546fbab59a74a66c83b8cb76b3f6877ce1d374 - + https://github.com/aspnet/Extensions - 66007df6e5b68683de0cab0dc6a8552265318f20 + f15f3278c73c72a6546d7cb2c1bd54a541ffc83e https://github.com/dotnet/roslyn diff --git a/eng/Versions.props b/eng/Versions.props index 3f451add81..005527da82 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -59,107 +59,107 @@ 3.4.0-beta1-19456-03 - 5.0.0-alpha1.19515.17 - 5.0.0-alpha1.19515.17 - 5.0.0-alpha1.19515.17 - 2.1.0-alpha1.19515.17 + 5.0.0-alpha1.19517.2 + 5.0.0-alpha1.19517.2 + 5.0.0-alpha1.19517.2 + 2.1.0-alpha1.19517.2 - 1.2.0-alpha1.19504.7 - 5.0.0-alpha1.19504.7 - 5.0.0-alpha1.19504.7 - 5.0.0-alpha1.19504.7 - 5.0.0-alpha1.19504.7 - 5.0.0-alpha1.19504.7 - 5.0.0-alpha1.19504.7 - 5.0.0-alpha1.19504.7 - 5.0.0-alpha1.19504.7 - 5.0.0-alpha1.19504.7 - 1.9.0-alpha1.19504.7 - 5.0.0-alpha1.19504.7 - 5.0.0-alpha1.19504.7 - 5.0.0-alpha1.19504.7 - 5.0.0-alpha1.19504.7 - 5.0.0-alpha1.19504.7 - 5.0.0-alpha1.19504.7 - 5.0.0-alpha1.19504.7 - 5.0.0-alpha1.19504.7 - 5.0.0-alpha1.19504.7 - 5.0.0-alpha1.19504.7 - 5.0.0-alpha1.19504.7 + 1.0.0 + 5.0.0-alpha1.19516.16 + 5.0.0-alpha1.19516.16 + 5.0.0-alpha1.19516.16 + 5.0.0-alpha1.19516.16 + 5.0.0-alpha1.19516.16 + 5.0.0-alpha1.19516.16 + 5.0.0-alpha1.19516.16 + 5.0.0-alpha1.19516.16 + 5.0.0-alpha1.19516.16 + 5.0.0-alpha1.19516.16 + 5.0.0-alpha1.19516.16 + 5.0.0-alpha1.19516.16 + 5.0.0-alpha1.19516.16 + 5.0.0-alpha1.19516.16 + 5.0.0-alpha1.19516.16 + 5.0.0-alpha1.19516.16 + 5.0.0-alpha1.19516.16 + 5.0.0-alpha1.19516.16 + 5.0.0-alpha1.19516.16 + 5.0.0-alpha1.19516.16 + 5.0.0-alpha1.19516.16 - 5.0.0-alpha1.19504.7 + 5.0.0-alpha1.19516.16 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-alpha1.19516.2 - 5.0.0-preview2.19516.2 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-alpha1.19517.7 + 5.0.0-preview2.19517.7 - 5.0.0-alpha1.19517.14 - 5.0.0-alpha1.19517.14 - 5.0.0-alpha1.19517.14 - 5.0.0-alpha1.19517.14 - 5.0.0-alpha1.19517.14 - 5.0.0-alpha1.19517.14 - 5.0.0-alpha1.19517.14 + 5.0.0-alpha1.19518.8 + 5.0.0-alpha1.19518.8 + 5.0.0-alpha1.19518.8 + 5.0.0-alpha1.19518.8 + 5.0.0-alpha1.19518.8 + 5.0.0-alpha1.19518.8 + 5.0.0-alpha1.19518.8 5.0.0-alpha1.19517.12 5.0.0-alpha1.19517.12 From 8255e3ef267fd327ec7e791b15b748d760af3761 Mon Sep 17 00:00:00 2001 From: Chris Ross Date: Mon, 21 Oct 2019 08:39:51 -0700 Subject: [PATCH 13/24] Convert sample project to sdk format #6505 (#15174) --- src/Middleware/WebSockets/WebSockets.slnf | 25 ++++++++ .../WebSockets/samples/EchoApp/EchoApp.csproj | 3 +- .../WebSockets/samples/TestServer/App.config | 6 -- .../TestServer/Properties/AssemblyInfo.cs | 36 ------------ .../TestServer/WebSockets.TestServer.csproj | 58 ++----------------- 5 files changed, 31 insertions(+), 97 deletions(-) create mode 100644 src/Middleware/WebSockets/WebSockets.slnf delete mode 100644 src/Middleware/WebSockets/samples/TestServer/App.config delete mode 100644 src/Middleware/WebSockets/samples/TestServer/Properties/AssemblyInfo.cs diff --git a/src/Middleware/WebSockets/WebSockets.slnf b/src/Middleware/WebSockets/WebSockets.slnf new file mode 100644 index 0000000000..1bd3b17518 --- /dev/null +++ b/src/Middleware/WebSockets/WebSockets.slnf @@ -0,0 +1,25 @@ +{ + "solution": { + "path": "..\\Middleware.sln", + "projects": [ + "..\\Hosting\\Abstractions\\src\\Microsoft.AspNetCore.Hosting.Abstractions.csproj", + "..\\Hosting\\Hosting\\src\\Microsoft.AspNetCore.Hosting.csproj", + "..\\Hosting\\Server.Abstractions\\src\\Microsoft.AspNetCore.Hosting.Server.Abstractions.csproj", + "..\\Hosting\\Server.IntegrationTesting\\src\\Microsoft.AspNetCore.Server.IntegrationTesting.csproj", + "..\\Http\\Http.Abstractions\\src\\Microsoft.AspNetCore.Http.Abstractions.csproj", + "..\\Http\\Http.Extensions\\src\\Microsoft.AspNetCore.Http.Extensions.csproj", + "..\\Http\\Http.Features\\src\\Microsoft.AspNetCore.Http.Features.csproj", + "..\\Servers\\Kestrel\\Core\\src\\Microsoft.AspNetCore.Server.Kestrel.Core.csproj", + "..\\Servers\\Kestrel\\Kestrel\\src\\Microsoft.AspNetCore.Server.Kestrel.csproj", + "..\\Servers\\Kestrel\\Transport.Sockets\\src\\Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.csproj", + "..\\Http\\Headers\\src\\Microsoft.Net.Http.Headers.csproj", + "..\\Http\\Http\\src\\Microsoft.AspNetCore.Http.csproj", + "WebSockets\\samples\\EchoApp\\EchoApp.csproj", + "WebSockets\\samples\\TestServer\\WebSockets.TestServer.csproj", + "WebSockets\\src\\Microsoft.AspNetCore.WebSockets.csproj", + "WebSockets\\test\\ConformanceTests\\AutobahnTestApp\\AutobahnTestApp.csproj", + "WebSockets\\test\\ConformanceTests\\Microsoft.AspNetCore.WebSockets.ConformanceTests.csproj", + "WebSockets\\test\\UnitTests\\Microsoft.AspNetCore.WebSockets.Tests.csproj" + ] + } +} \ No newline at end of file diff --git a/src/Middleware/WebSockets/samples/EchoApp/EchoApp.csproj b/src/Middleware/WebSockets/samples/EchoApp/EchoApp.csproj index 15f4b19a4f..c92354b6f5 100644 --- a/src/Middleware/WebSockets/samples/EchoApp/EchoApp.csproj +++ b/src/Middleware/WebSockets/samples/EchoApp/EchoApp.csproj @@ -1,7 +1,8 @@ - + $(DefaultNetCoreTargetFramework) + OutOfProcess diff --git a/src/Middleware/WebSockets/samples/TestServer/App.config b/src/Middleware/WebSockets/samples/TestServer/App.config deleted file mode 100644 index 731f6de6c2..0000000000 --- a/src/Middleware/WebSockets/samples/TestServer/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/Middleware/WebSockets/samples/TestServer/Properties/AssemblyInfo.cs b/src/Middleware/WebSockets/samples/TestServer/Properties/AssemblyInfo.cs deleted file mode 100644 index 1a5999f7d8..0000000000 --- a/src/Middleware/WebSockets/samples/TestServer/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("TestServer")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("TestServer")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("ffe69337-e3b4-4625-8244-36bd609742ba")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Middleware/WebSockets/samples/TestServer/WebSockets.TestServer.csproj b/src/Middleware/WebSockets/samples/TestServer/WebSockets.TestServer.csproj index b3e359eaef..495754aced 100644 --- a/src/Middleware/WebSockets/samples/TestServer/WebSockets.TestServer.csproj +++ b/src/Middleware/WebSockets/samples/TestServer/WebSockets.TestServer.csproj @@ -1,58 +1,8 @@ - - - + + - Debug - AnyCPU - {4E5F5FCC-172C-44D9-BEA0-39098A79CD0B} + net472 Exe - Properties - TestServer - TestServer - v4.6.1 - 512 - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - + From c1cc1684415f2aab86471230346856e8e09dcd43 Mon Sep 17 00:00:00 2001 From: Kahbazi Date: Mon, 21 Oct 2019 19:18:51 +0330 Subject: [PATCH 14/24] Add Backlog to SocketTransportOptions and LibuvTransportOptions (#15111) --- ...spNetCore.Server.Kestrel.Transport.Libuv.netcoreapp.cs | 1 + .../Transport.Libuv/src/Internal/LibuvConstants.cs | 4 +--- .../Kestrel/Transport.Libuv/src/Internal/Listener.cs | 2 +- .../Transport.Libuv/src/Internal/ListenerPrimary.cs | 2 +- .../Kestrel/Transport.Libuv/src/LibuvTransportOptions.cs | 8 ++++++++ ...NetCore.Server.Kestrel.Transport.Sockets.netcoreapp.cs | 1 + .../Transport.Sockets/src/SocketConnectionListener.cs | 2 +- .../Transport.Sockets/src/SocketTransportOptions.cs | 8 ++++++++ 8 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/Servers/Kestrel/Transport.Libuv/ref/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.netcoreapp.cs b/src/Servers/Kestrel/Transport.Libuv/ref/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.netcoreapp.cs index f24337e79d..e6fa605b47 100644 --- a/src/Servers/Kestrel/Transport.Libuv/ref/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.netcoreapp.cs +++ b/src/Servers/Kestrel/Transport.Libuv/ref/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.netcoreapp.cs @@ -14,6 +14,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv public partial class LibuvTransportOptions { public LibuvTransportOptions() { } + public int Backlog { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public long? MaxReadBufferSize { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public long? MaxWriteBufferSize { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public bool NoDelay { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } diff --git a/src/Servers/Kestrel/Transport.Libuv/src/Internal/LibuvConstants.cs b/src/Servers/Kestrel/Transport.Libuv/src/Internal/LibuvConstants.cs index 0e07f1a69c..1e5b7bb75b 100644 --- a/src/Servers/Kestrel/Transport.Libuv/src/Internal/LibuvConstants.cs +++ b/src/Servers/Kestrel/Transport.Libuv/src/Internal/LibuvConstants.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Runtime.CompilerServices; @@ -8,8 +8,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal { internal static class LibuvConstants { - public const int ListenBacklog = 128; - public const int EOF = -4095; public static readonly int? ECONNRESET = GetECONNRESET(); public static readonly int? EADDRINUSE = GetEADDRINUSE(); diff --git a/src/Servers/Kestrel/Transport.Libuv/src/Internal/Listener.cs b/src/Servers/Kestrel/Transport.Libuv/src/Internal/Listener.cs index 9dc11a31a4..6279764101 100644 --- a/src/Servers/Kestrel/Transport.Libuv/src/Internal/Listener.cs +++ b/src/Servers/Kestrel/Transport.Libuv/src/Internal/Listener.cs @@ -37,7 +37,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal return Thread.PostAsync(listener => { listener.ListenSocket = listener.CreateListenSocket(); - listener.ListenSocket.Listen(LibuvConstants.ListenBacklog, ConnectionCallback, listener); + listener.ListenSocket.Listen(TransportContext.Options.Backlog, ConnectionCallback, listener); }, this); } diff --git a/src/Servers/Kestrel/Transport.Libuv/src/Internal/ListenerPrimary.cs b/src/Servers/Kestrel/Transport.Libuv/src/Internal/ListenerPrimary.cs index acbc356294..add394b5e3 100644 --- a/src/Servers/Kestrel/Transport.Libuv/src/Internal/ListenerPrimary.cs +++ b/src/Servers/Kestrel/Transport.Libuv/src/Internal/ListenerPrimary.cs @@ -69,7 +69,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal ListenPipe = new UvPipeHandle(Log); ListenPipe.Init(Thread.Loop, Thread.QueueCloseHandle, false); ListenPipe.Bind(_pipeName); - ListenPipe.Listen(LibuvConstants.ListenBacklog, + ListenPipe.Listen(TransportContext.Options.Backlog, (pipe, status, error, state) => ((ListenerPrimary)state).OnListenPipe(pipe, status, error), this); } diff --git a/src/Servers/Kestrel/Transport.Libuv/src/LibuvTransportOptions.cs b/src/Servers/Kestrel/Transport.Libuv/src/LibuvTransportOptions.cs index 06c8aec796..0aa477f3af 100644 --- a/src/Servers/Kestrel/Transport.Libuv/src/LibuvTransportOptions.cs +++ b/src/Servers/Kestrel/Transport.Libuv/src/LibuvTransportOptions.cs @@ -27,6 +27,14 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv /// public bool NoDelay { get; set; } = true; + /// + /// The maximum length of the pending connection queue. + /// + /// + /// Defaults to 128. + /// + public int Backlog { get; set; } = 128; + public long? MaxReadBufferSize { get; set; } = 1024 * 1024; public long? MaxWriteBufferSize { get; set; } = 64 * 1024; diff --git a/src/Servers/Kestrel/Transport.Sockets/ref/Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.netcoreapp.cs b/src/Servers/Kestrel/Transport.Sockets/ref/Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.netcoreapp.cs index c1e32cc39d..e54b0a2d21 100644 --- a/src/Servers/Kestrel/Transport.Sockets/ref/Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.netcoreapp.cs +++ b/src/Servers/Kestrel/Transport.Sockets/ref/Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.netcoreapp.cs @@ -19,6 +19,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets public partial class SocketTransportOptions { public SocketTransportOptions() { } + public int Backlog { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public int IOQueueCount { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public long? MaxReadBufferSize { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public long? MaxWriteBufferSize { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } diff --git a/src/Servers/Kestrel/Transport.Sockets/src/SocketConnectionListener.cs b/src/Servers/Kestrel/Transport.Sockets/src/SocketConnectionListener.cs index 600d674d98..f829ae5591 100644 --- a/src/Servers/Kestrel/Transport.Sockets/src/SocketConnectionListener.cs +++ b/src/Servers/Kestrel/Transport.Sockets/src/SocketConnectionListener.cs @@ -93,7 +93,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets EndPoint = listenSocket.LocalEndPoint; - listenSocket.Listen(512); + listenSocket.Listen(_options.Backlog); _listenSocket = listenSocket; } diff --git a/src/Servers/Kestrel/Transport.Sockets/src/SocketTransportOptions.cs b/src/Servers/Kestrel/Transport.Sockets/src/SocketTransportOptions.cs index 4adb16ebfb..424a4375ae 100644 --- a/src/Servers/Kestrel/Transport.Sockets/src/SocketTransportOptions.cs +++ b/src/Servers/Kestrel/Transport.Sockets/src/SocketTransportOptions.cs @@ -24,6 +24,14 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets /// public bool NoDelay { get; set; } = true; + /// + /// The maximum length of the pending connection queue. + /// + /// + /// Defaults to 512. + /// + public int Backlog { get; set; } = 512; + public long? MaxReadBufferSize { get; set; } = 1024 * 1024; public long? MaxWriteBufferSize { get; set; } = 64 * 1024; From a0eb923ab58193944f333880b2ab61ce2ca62725 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Mon, 21 Oct 2019 10:08:52 -0700 Subject: [PATCH 15/24] Add TryAddScheme (#14448) --- ....Authentication.Abstractions.netcoreapp.cs | 1 + .../src/IAuthenticationSchemeProvider.cs | 17 ++++++++++++ ...pNetCore.Authentication.Core.netcoreapp.cs | 1 + .../src/AuthenticationSchemeProvider.cs | 27 ++++++++++++++++--- .../test/AuthenticationSchemeProviderTests.cs | 17 ++++++++++++ 5 files changed, 60 insertions(+), 3 deletions(-) diff --git a/src/Http/Authentication.Abstractions/ref/Microsoft.AspNetCore.Authentication.Abstractions.netcoreapp.cs b/src/Http/Authentication.Abstractions/ref/Microsoft.AspNetCore.Authentication.Abstractions.netcoreapp.cs index dd9628c89a..00d49aba92 100644 --- a/src/Http/Authentication.Abstractions/ref/Microsoft.AspNetCore.Authentication.Abstractions.netcoreapp.cs +++ b/src/Http/Authentication.Abstractions/ref/Microsoft.AspNetCore.Authentication.Abstractions.netcoreapp.cs @@ -149,6 +149,7 @@ namespace Microsoft.AspNetCore.Authentication System.Threading.Tasks.Task> GetRequestHandlerSchemesAsync(); System.Threading.Tasks.Task GetSchemeAsync(string name); void RemoveScheme(string name); + bool TryAddScheme(Microsoft.AspNetCore.Authentication.AuthenticationScheme scheme) { throw null; } } public partial interface IAuthenticationService { diff --git a/src/Http/Authentication.Abstractions/src/IAuthenticationSchemeProvider.cs b/src/Http/Authentication.Abstractions/src/IAuthenticationSchemeProvider.cs index 3d2584fca8..d0f54d74d0 100644 --- a/src/Http/Authentication.Abstractions/src/IAuthenticationSchemeProvider.cs +++ b/src/Http/Authentication.Abstractions/src/IAuthenticationSchemeProvider.cs @@ -71,6 +71,23 @@ namespace Microsoft.AspNetCore.Authentication /// The scheme. void AddScheme(AuthenticationScheme scheme); + /// + /// Registers a scheme for use by . + /// + /// The scheme. + /// true if the scheme was added successfully. + bool TryAddScheme(AuthenticationScheme scheme) + { + try + { + AddScheme(scheme); + return true; + } + catch { + return false; + } + } + /// /// Removes a scheme, preventing it from being used by . /// diff --git a/src/Http/Authentication.Core/ref/Microsoft.AspNetCore.Authentication.Core.netcoreapp.cs b/src/Http/Authentication.Core/ref/Microsoft.AspNetCore.Authentication.Core.netcoreapp.cs index f12e27bcf2..0267014059 100644 --- a/src/Http/Authentication.Core/ref/Microsoft.AspNetCore.Authentication.Core.netcoreapp.cs +++ b/src/Http/Authentication.Core/ref/Microsoft.AspNetCore.Authentication.Core.netcoreapp.cs @@ -30,6 +30,7 @@ namespace Microsoft.AspNetCore.Authentication public virtual System.Threading.Tasks.Task> GetRequestHandlerSchemesAsync() { throw null; } public virtual System.Threading.Tasks.Task GetSchemeAsync(string name) { throw null; } public virtual void RemoveScheme(string name) { } + public virtual bool TryAddScheme(Microsoft.AspNetCore.Authentication.AuthenticationScheme scheme) { throw null; } } public partial class AuthenticationService : Microsoft.AspNetCore.Authentication.IAuthenticationService { diff --git a/src/Http/Authentication.Core/src/AuthenticationSchemeProvider.cs b/src/Http/Authentication.Core/src/AuthenticationSchemeProvider.cs index a7b913b1b2..4f181081f2 100644 --- a/src/Http/Authentication.Core/src/AuthenticationSchemeProvider.cs +++ b/src/Http/Authentication.Core/src/AuthenticationSchemeProvider.cs @@ -133,17 +133,18 @@ namespace Microsoft.AspNetCore.Authentication /// Registers a scheme for use by . /// /// The scheme. - public virtual void AddScheme(AuthenticationScheme scheme) + /// true if the scheme was added successfully. + public virtual bool TryAddScheme(AuthenticationScheme scheme) { if (_schemes.ContainsKey(scheme.Name)) { - throw new InvalidOperationException("Scheme already exists: " + scheme.Name); + return false; } lock (_lock) { if (_schemes.ContainsKey(scheme.Name)) { - throw new InvalidOperationException("Scheme already exists: " + scheme.Name); + return false; } if (typeof(IAuthenticationRequestHandler).IsAssignableFrom(scheme.HandlerType)) { @@ -152,6 +153,26 @@ namespace Microsoft.AspNetCore.Authentication } _schemes[scheme.Name] = scheme; _schemesCopy = _schemes.Values.ToArray(); + return true; + } + } + + /// + /// Registers a scheme for use by . + /// + /// The scheme. + public virtual void AddScheme(AuthenticationScheme scheme) + { + if (_schemes.ContainsKey(scheme.Name)) + { + throw new InvalidOperationException("Scheme already exists: " + scheme.Name); + } + lock (_lock) + { + if (!TryAddScheme(scheme)) + { + throw new InvalidOperationException("Scheme already exists: " + scheme.Name); + } } } diff --git a/src/Http/Authentication.Core/test/AuthenticationSchemeProviderTests.cs b/src/Http/Authentication.Core/test/AuthenticationSchemeProviderTests.cs index 82602000aa..8ef2f9d347 100644 --- a/src/Http/Authentication.Core/test/AuthenticationSchemeProviderTests.cs +++ b/src/Http/Authentication.Core/test/AuthenticationSchemeProviderTests.cs @@ -133,6 +133,23 @@ namespace Microsoft.AspNetCore.Authentication Assert.Contains("Scheme already exists: signin", error.Message); } + [Fact] + public void CanSafelyTryAddSchemes() + { + var services = new ServiceCollection().AddOptions().AddAuthenticationCore(o => + { + }).BuildServiceProvider(); + + var o = services.GetRequiredService(); + Assert.True(o.TryAddScheme(new AuthenticationScheme("signin", "whatever", typeof(Handler)))); + Assert.True(o.TryAddScheme(new AuthenticationScheme("signin2", "whatever", typeof(Handler)))); + Assert.False(o.TryAddScheme(new AuthenticationScheme("signin", "whatever", typeof(Handler)))); + Assert.True(o.TryAddScheme(new AuthenticationScheme("signin3", "whatever", typeof(Handler)))); + Assert.False(o.TryAddScheme(new AuthenticationScheme("signin2", "whatever", typeof(Handler)))); + o.RemoveScheme("signin2"); + Assert.True(o.TryAddScheme(new AuthenticationScheme("signin2", "whatever", typeof(Handler)))); + } + [Fact] public async Task LookupUsesProvidedStringComparer() { From b2edf785d7c5e1a7230ecf7c17d44ce29842c4fe Mon Sep 17 00:00:00 2001 From: Artak <34246760+mkArtakMSFT@users.noreply.github.com> Date: Mon, 21 Oct 2019 13:03:48 -0700 Subject: [PATCH 16/24] Added `api-suggestion` label (#15240) --- .github/labeler.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/labeler.yml b/.github/labeler.yml index 83509a9fd2..5e44e2f2e8 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -51,3 +51,6 @@ area-signalr: - src/SignalR/**/* #area-websockets: + +api-suggestion: + - src/**/ref/**/* From 4303bbe78650abf0bc6941d81956b02e4357feb5 Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Mon, 21 Oct 2019 22:18:09 -0700 Subject: [PATCH 17/24] Clarify documentation of RefreshSignInAsync (#10637) Helps to address issues of confusion raised in https://github.com/aspnet/Identity/issues/1900 and https://github.com/aspnet/AspNetCore/issues/5844 --- src/Identity/Core/src/SignInManager.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Identity/Core/src/SignInManager.cs b/src/Identity/Core/src/SignInManager.cs index 8cae14795a..e54c0f6155 100644 --- a/src/Identity/Core/src/SignInManager.cs +++ b/src/Identity/Core/src/SignInManager.cs @@ -161,10 +161,10 @@ namespace Microsoft.AspNetCore.Identity } /// - /// Regenerates the user's application cookie, whilst preserving the existing - /// AuthenticationProperties like rememberMe, as an asynchronous operation. + /// Signs in the specified , whilst preserving the existing + /// AuthenticationProperties of the current signed-in user like rememberMe, as an asynchronous operation. /// - /// The user whose sign-in cookie should be refreshed. + /// The user to sign-in. /// The task object representing the asynchronous operation. public virtual async Task RefreshSignInAsync(TUser user) { From 1189a2c294df55d7a67f1bc6ea74d74858f467bd Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Tue, 22 Oct 2019 12:04:22 +0200 Subject: [PATCH 18/24] [SPA] Fixes the error message on timeouts (#15220) When the angular CLI middleware takes too long to start, it produces an error message with an incorrect value, as it uses `timeSpan.Seconds` instead of `timeSpan.TotalSeconds` --- .../src/AngularCli/AngularCliMiddleware.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Middleware/SpaServices.Extensions/src/AngularCli/AngularCliMiddleware.cs b/src/Middleware/SpaServices.Extensions/src/AngularCli/AngularCliMiddleware.cs index c4e109b8f7..a852cc37fa 100644 --- a/src/Middleware/SpaServices.Extensions/src/AngularCli/AngularCliMiddleware.cs +++ b/src/Middleware/SpaServices.Extensions/src/AngularCli/AngularCliMiddleware.cs @@ -57,7 +57,7 @@ namespace Microsoft.AspNetCore.SpaServices.AngularCli var timeout = spaBuilder.Options.StartupTimeout; return targetUriTask.WithTimeout(timeout, $"The Angular CLI process did not start listening for requests " + - $"within the timeout period of {timeout.Seconds} seconds. " + + $"within the timeout period of {timeout.TotalSeconds} seconds. " + $"Check the log output for error information."); }); } From 1ba180e87cd2ee1cde4db51d87739b77106546c4 Mon Sep 17 00:00:00 2001 From: Chris Ross Date: Tue, 22 Oct 2019 10:05:37 -0700 Subject: [PATCH 19/24] Remove Microsoft.AspNetCore.SuppressSameSiteNone compat switch #14739 (#15092) --- src/Http/Headers/src/SetCookieHeaderValue.cs | 25 ++--- .../Headers/test/SetCookieHeaderValueTest.cs | 98 ------------------- .../Http.Abstractions/src/CookieBuilder.cs | 14 +-- src/Http/Http.Features/src/CookieOptions.cs | 14 +-- .../CookiePolicy/src/CookiePolicyOptions.cs | 14 +-- .../src/ResponseCookiesWrapper.cs | 3 +- 6 files changed, 10 insertions(+), 158 deletions(-) diff --git a/src/Http/Headers/src/SetCookieHeaderValue.cs b/src/Http/Headers/src/SetCookieHeaderValue.cs index 3a5b217d6c..cdf12381aa 100644 --- a/src/Http/Headers/src/SetCookieHeaderValue.cs +++ b/src/Http/Headers/src/SetCookieHeaderValue.cs @@ -24,10 +24,6 @@ namespace Microsoft.Net.Http.Headers private static readonly string SameSiteLaxToken = SameSiteMode.Lax.ToString().ToLower(); private static readonly string SameSiteStrictToken = SameSiteMode.Strict.ToString().ToLower(); - // True (old): https://tools.ietf.org/html/draft-west-first-party-cookies-07#section-3.1 - // False (new): https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.1 - internal static bool SuppressSameSiteNone; - private const string HttpOnlyToken = "httponly"; private const string SeparatorToken = "; "; private const string EqualsToken = "="; @@ -42,14 +38,6 @@ namespace Microsoft.Net.Http.Headers private StringSegment _name; private StringSegment _value; - static SetCookieHeaderValue() - { - if (AppContext.TryGetSwitch("Microsoft.AspNetCore.SuppressSameSiteNone", out var enabled)) - { - SuppressSameSiteNone = enabled; - } - } - private SetCookieHeaderValue() { // Used by the parser to create a new instance of this type. @@ -106,7 +94,7 @@ namespace Microsoft.Net.Http.Headers public bool Secure { get; set; } - public SameSiteMode SameSite { get; set; } = SuppressSameSiteNone ? SameSiteMode.None : SameSiteMode.Unspecified; + public SameSiteMode SameSite { get; set; } = SameSiteMode.Unspecified; public bool HttpOnly { get; set; } @@ -145,7 +133,7 @@ namespace Microsoft.Net.Http.Headers } // Allow for Unspecified (-1) to skip SameSite - if (SameSite == SameSiteMode.None && !SuppressSameSiteNone) + if (SameSite == SameSiteMode.None) { sameSite = SameSiteNoneToken; length += SeparatorToken.Length + SameSiteToken.Length + EqualsToken.Length + sameSite.Length; @@ -275,7 +263,7 @@ namespace Microsoft.Net.Http.Headers } // Allow for Unspecified (-1) to skip SameSite - if (SameSite == SameSiteMode.None && !SuppressSameSiteNone) + if (SameSite == SameSiteMode.None) { AppendSegment(builder, SameSiteToken, SameSiteNoneToken); } @@ -478,7 +466,7 @@ namespace Microsoft.Net.Http.Headers { if (!ReadEqualsSign(input, ref offset)) { - result.SameSite = SuppressSameSiteNone ? SameSiteMode.Strict : SameSiteMode.Unspecified; + result.SameSite = SameSiteMode.Unspecified; } else { @@ -492,14 +480,13 @@ namespace Microsoft.Net.Http.Headers { result.SameSite = SameSiteMode.Lax; } - else if (!SuppressSameSiteNone - && StringSegment.Equals(enforcementMode, SameSiteNoneToken, StringComparison.OrdinalIgnoreCase)) + else if (StringSegment.Equals(enforcementMode, SameSiteNoneToken, StringComparison.OrdinalIgnoreCase)) { result.SameSite = SameSiteMode.None; } else { - result.SameSite = SuppressSameSiteNone ? SameSiteMode.Strict : SameSiteMode.Unspecified; + result.SameSite = SameSiteMode.Unspecified; } } } diff --git a/src/Http/Headers/test/SetCookieHeaderValueTest.cs b/src/Http/Headers/test/SetCookieHeaderValueTest.cs index 11593b4f93..4f33c54599 100644 --- a/src/Http/Headers/test/SetCookieHeaderValueTest.cs +++ b/src/Http/Headers/test/SetCookieHeaderValueTest.cs @@ -313,28 +313,6 @@ namespace Microsoft.Net.Http.Headers Assert.Equal(expectedValue, input.ToString()); } - [Fact] - public void SetCookieHeaderValue_ToString_SameSiteNoneCompat() - { - SetCookieHeaderValue.SuppressSameSiteNone = true; - - var input = new SetCookieHeaderValue("name", "value") - { - SameSite = SameSiteMode.None, - }; - - Assert.Equal("name=value", input.ToString()); - - SetCookieHeaderValue.SuppressSameSiteNone = false; - - var input2 = new SetCookieHeaderValue("name", "value") - { - SameSite = SameSiteMode.None, - }; - - Assert.Equal("name=value; samesite=none", input2.ToString()); - } - [Theory] [MemberData(nameof(SetCookieHeaderDataSet))] public void SetCookieHeaderValue_AppendToStringBuilder(SetCookieHeaderValue input, string expectedValue) @@ -346,32 +324,6 @@ namespace Microsoft.Net.Http.Headers Assert.Equal(expectedValue, builder.ToString()); } - [Fact] - public void SetCookieHeaderValue_AppendToStringBuilder_SameSiteNoneCompat() - { - SetCookieHeaderValue.SuppressSameSiteNone = true; - - var builder = new StringBuilder(); - var input = new SetCookieHeaderValue("name", "value") - { - SameSite = SameSiteMode.None, - }; - - input.AppendToStringBuilder(builder); - Assert.Equal("name=value", builder.ToString()); - - SetCookieHeaderValue.SuppressSameSiteNone = false; - - var builder2 = new StringBuilder(); - var input2 = new SetCookieHeaderValue("name", "value") - { - SameSite = SameSiteMode.None, - }; - - input2.AppendToStringBuilder(builder2); - Assert.Equal("name=value; samesite=none", builder2.ToString()); - } - [Theory] [MemberData(nameof(SetCookieHeaderDataSet))] public void SetCookieHeaderValue_Parse_AcceptsValidValues(SetCookieHeaderValue cookie, string expectedValue) @@ -382,31 +334,6 @@ namespace Microsoft.Net.Http.Headers Assert.Equal(expectedValue, header.ToString()); } - [Fact] - public void SetCookieHeaderValue_Parse_AcceptsValidValues_SameSiteNoneCompat() - { - SetCookieHeaderValue.SuppressSameSiteNone = true; - var header = SetCookieHeaderValue.Parse("name=value; samesite=none"); - - var cookie = new SetCookieHeaderValue("name", "value") - { - SameSite = SameSiteMode.Strict, - }; - - Assert.Equal(cookie, header); - Assert.Equal("name=value; samesite=strict", header.ToString()); - SetCookieHeaderValue.SuppressSameSiteNone = false; - - var header2 = SetCookieHeaderValue.Parse("name=value; samesite=none"); - - var cookie2 = new SetCookieHeaderValue("name", "value") - { - SameSite = SameSiteMode.None, - }; - Assert.Equal(cookie2, header2); - Assert.Equal("name=value; samesite=none", header2.ToString()); - } - [Theory] [MemberData(nameof(SetCookieHeaderDataSet))] public void SetCookieHeaderValue_TryParse_AcceptsValidValues(SetCookieHeaderValue cookie, string expectedValue) @@ -417,31 +344,6 @@ namespace Microsoft.Net.Http.Headers Assert.Equal(expectedValue, header.ToString()); } - [Fact] - public void SetCookieHeaderValue_TryParse_AcceptsValidValues_SameSiteNoneCompat() - { - SetCookieHeaderValue.SuppressSameSiteNone = true; - Assert.True(SetCookieHeaderValue.TryParse("name=value; samesite=none", out var header)); - var cookie = new SetCookieHeaderValue("name", "value") - { - SameSite = SameSiteMode.Strict, - }; - - Assert.Equal(cookie, header); - Assert.Equal("name=value; samesite=strict", header.ToString()); - - SetCookieHeaderValue.SuppressSameSiteNone = false; - - Assert.True(SetCookieHeaderValue.TryParse("name=value; samesite=none", out var header2)); - var cookie2 = new SetCookieHeaderValue("name", "value") - { - SameSite = SameSiteMode.None, - }; - - Assert.Equal(cookie2, header2); - Assert.Equal("name=value; samesite=none", header2.ToString()); - } - [Theory] [MemberData(nameof(InvalidSetCookieHeaderDataSet))] public void SetCookieHeaderValue_Parse_RejectsInvalidValues(string value) diff --git a/src/Http/Http.Abstractions/src/CookieBuilder.cs b/src/Http/Http.Abstractions/src/CookieBuilder.cs index 46ed33e7f8..a94d90f1cd 100644 --- a/src/Http/Http.Abstractions/src/CookieBuilder.cs +++ b/src/Http/Http.Abstractions/src/CookieBuilder.cs @@ -11,20 +11,8 @@ namespace Microsoft.AspNetCore.Http /// public class CookieBuilder { - // True (old): https://tools.ietf.org/html/draft-west-first-party-cookies-07#section-3.1 - // False (new): https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.1 - internal static bool SuppressSameSiteNone; - private string _name; - static CookieBuilder() - { - if (AppContext.TryGetSwitch("Microsoft.AspNetCore.SuppressSameSiteNone", out var enabled)) - { - SuppressSameSiteNone = enabled; - } - } - /// /// The name of the cookie. /// @@ -66,7 +54,7 @@ namespace Microsoft.AspNetCore.Http /// /// Determines the value that will set on . /// - public virtual SameSiteMode SameSite { get; set; } = SuppressSameSiteNone ? SameSiteMode.None : SameSiteMode.Unspecified; + public virtual SameSiteMode SameSite { get; set; } = SameSiteMode.Unspecified; /// /// The policy that will be used to determine . diff --git a/src/Http/Http.Features/src/CookieOptions.cs b/src/Http/Http.Features/src/CookieOptions.cs index 6720ad6f05..833eeedea2 100644 --- a/src/Http/Http.Features/src/CookieOptions.cs +++ b/src/Http/Http.Features/src/CookieOptions.cs @@ -10,18 +10,6 @@ namespace Microsoft.AspNetCore.Http /// public class CookieOptions { - // True (old): https://tools.ietf.org/html/draft-west-first-party-cookies-07#section-3.1 - // False (new): https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.1 - internal static bool SuppressSameSiteNone; - - static CookieOptions() - { - if (AppContext.TryGetSwitch("Microsoft.AspNetCore.SuppressSameSiteNone", out var enabled)) - { - SuppressSameSiteNone = enabled; - } - } - /// /// Creates a default cookie with a path of '/'. /// @@ -58,7 +46,7 @@ namespace Microsoft.AspNetCore.Http /// Gets or sets the value for the SameSite attribute of the cookie. The default value is /// /// The representing the enforcement mode of the cookie. - public SameSiteMode SameSite { get; set; } = SuppressSameSiteNone ? SameSiteMode.None : SameSiteMode.Unspecified; + public SameSiteMode SameSite { get; set; } = SameSiteMode.Unspecified; /// /// Gets or sets a value that indicates whether a cookie is accessible by client-side script. diff --git a/src/Security/CookiePolicy/src/CookiePolicyOptions.cs b/src/Security/CookiePolicy/src/CookiePolicyOptions.cs index 098bd33483..56e5998808 100644 --- a/src/Security/CookiePolicy/src/CookiePolicyOptions.cs +++ b/src/Security/CookiePolicy/src/CookiePolicyOptions.cs @@ -12,22 +12,10 @@ namespace Microsoft.AspNetCore.Builder /// public class CookiePolicyOptions { - // True (old): https://tools.ietf.org/html/draft-west-first-party-cookies-07#section-3.1 - // False (new): https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.1 - internal static bool SuppressSameSiteNone; - - static CookiePolicyOptions() - { - if (AppContext.TryGetSwitch("Microsoft.AspNetCore.SuppressSameSiteNone", out var enabled)) - { - SuppressSameSiteNone = enabled; - } - } - /// /// Affects the cookie's same site attribute. /// - public SameSiteMode MinimumSameSitePolicy { get; set; } = SuppressSameSiteNone ? SameSiteMode.None : SameSiteMode.Unspecified; + public SameSiteMode MinimumSameSitePolicy { get; set; } = SameSiteMode.Unspecified; /// /// Affects whether cookies must be HttpOnly. diff --git a/src/Security/CookiePolicy/src/ResponseCookiesWrapper.cs b/src/Security/CookiePolicy/src/ResponseCookiesWrapper.cs index 879df47018..cdd2454fa6 100644 --- a/src/Security/CookiePolicy/src/ResponseCookiesWrapper.cs +++ b/src/Security/CookiePolicy/src/ResponseCookiesWrapper.cs @@ -115,8 +115,7 @@ namespace Microsoft.AspNetCore.CookiePolicy private bool CheckPolicyRequired() { return !CanTrack - || (CookiePolicyOptions.SuppressSameSiteNone && Options.MinimumSameSitePolicy != SameSiteMode.None) - || (!CookiePolicyOptions.SuppressSameSiteNone && Options.MinimumSameSitePolicy != SameSiteMode.Unspecified) + || Options.MinimumSameSitePolicy != SameSiteMode.Unspecified || Options.HttpOnly != HttpOnlyPolicy.None || Options.Secure != CookieSecurePolicy.None; } From b960e07e37144ccd10512a5ac669f54d938b24ab Mon Sep 17 00:00:00 2001 From: Nikita Potapenko Date: Tue, 22 Oct 2019 20:28:17 +0300 Subject: [PATCH 20/24] Add hubType to HubInvocationContext (#14459) --- ...osoft.AspNetCore.SignalR.Core.netcoreapp.cs | 2 ++ .../server/Core/src/HubInvocationContext.cs | 18 ++++++++++++++++++ .../Core/src/Internal/DefaultHubDispatcher.cs | 2 +- .../SignalR/test/HubConnectionHandlerTests.cs | 1 + 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/SignalR/server/Core/ref/Microsoft.AspNetCore.SignalR.Core.netcoreapp.cs b/src/SignalR/server/Core/ref/Microsoft.AspNetCore.SignalR.Core.netcoreapp.cs index 5309dae32c..f266b11a88 100644 --- a/src/SignalR/server/Core/ref/Microsoft.AspNetCore.SignalR.Core.netcoreapp.cs +++ b/src/SignalR/server/Core/ref/Microsoft.AspNetCore.SignalR.Core.netcoreapp.cs @@ -176,9 +176,11 @@ namespace Microsoft.AspNetCore.SignalR public partial class HubInvocationContext { public HubInvocationContext(Microsoft.AspNetCore.SignalR.HubCallerContext context, string hubMethodName, object[] hubMethodArguments) { } + public HubInvocationContext(Microsoft.AspNetCore.SignalR.HubCallerContext context, System.Type hubType, string hubMethodName, object[] hubMethodArguments) { } public Microsoft.AspNetCore.SignalR.HubCallerContext Context { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public System.Collections.Generic.IReadOnlyList HubMethodArguments { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public string HubMethodName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Type HubType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } } public abstract partial class HubLifetimeManager where THub : Microsoft.AspNetCore.SignalR.Hub { diff --git a/src/SignalR/server/Core/src/HubInvocationContext.cs b/src/SignalR/server/Core/src/HubInvocationContext.cs index a62706d6a8..967db6ebb5 100644 --- a/src/SignalR/server/Core/src/HubInvocationContext.cs +++ b/src/SignalR/server/Core/src/HubInvocationContext.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Collections.Generic; using Microsoft.AspNetCore.Authorization; @@ -11,6 +12,18 @@ namespace Microsoft.AspNetCore.SignalR /// public class HubInvocationContext { + /// + /// Instantiates a new instance of the class. + /// + /// Context for the active Hub connection and caller. + /// The type of the Hub. + /// The name of the Hub method being invoked. + /// The arguments provided by the client. + public HubInvocationContext(HubCallerContext context, Type hubType, string hubMethodName, object[] hubMethodArguments): this(context, hubMethodName, hubMethodArguments) + { + HubType = hubType; + } + /// /// Instantiates a new instance of the class. /// @@ -29,6 +42,11 @@ namespace Microsoft.AspNetCore.SignalR /// public HubCallerContext Context { get; } + /// + /// Gets the Hub type. + /// + public Type HubType { get; } + /// /// Gets the name of the Hub method being invoked. /// diff --git a/src/SignalR/server/Core/src/Internal/DefaultHubDispatcher.cs b/src/SignalR/server/Core/src/Internal/DefaultHubDispatcher.cs index bc0f8c9fc5..8d54b6d0ae 100644 --- a/src/SignalR/server/Core/src/Internal/DefaultHubDispatcher.cs +++ b/src/SignalR/server/Core/src/Internal/DefaultHubDispatcher.cs @@ -495,7 +495,7 @@ namespace Microsoft.AspNetCore.SignalR.Internal return TaskCache.True; } - return IsHubMethodAuthorizedSlow(provider, hubConnectionContext.User, policies, new HubInvocationContext(hubConnectionContext.HubCallerContext, hubMethodName, hubMethodArguments)); + return IsHubMethodAuthorizedSlow(provider, hubConnectionContext.User, policies, new HubInvocationContext(hubConnectionContext.HubCallerContext, typeof(THub), hubMethodName, hubMethodArguments)); } private static async Task IsHubMethodAuthorizedSlow(IServiceProvider provider, ClaimsPrincipal principal, IList policies, HubInvocationContext resource) diff --git a/src/SignalR/server/SignalR/test/HubConnectionHandlerTests.cs b/src/SignalR/server/SignalR/test/HubConnectionHandlerTests.cs index c88f593db2..5c6f9d9def 100644 --- a/src/SignalR/server/SignalR/test/HubConnectionHandlerTests.cs +++ b/src/SignalR/server/SignalR/test/HubConnectionHandlerTests.cs @@ -2215,6 +2215,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests { Assert.NotNull(context.Resource); var resource = Assert.IsType(context.Resource); + Assert.Equal(typeof(MethodHub), resource.HubType); Assert.Equal(nameof(MethodHub.MultiParamAuthMethod), resource.HubMethodName); Assert.Equal(2, resource.HubMethodArguments?.Count); Assert.Equal("Hello", resource.HubMethodArguments[0]); From 8a4b839cd396029d14aff33a625d0d7a8f4e1f99 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Tue, 22 Oct 2019 12:56:28 -0700 Subject: [PATCH 21/24] Fixes in DownloadPersonalData (#14203) * Fixes in DownloadPersonalData * use SerializeToUTf8 instead * Remove reference to newtonsoft --- src/Identity/UI/ref/Microsoft.AspNetCore.Identity.UI.csproj | 1 - .../Pages/V3/Account/Manage/DownloadPersonalData.cshtml.cs | 4 ++-- .../Pages/V4/Account/Manage/DownloadPersonalData.cshtml.cs | 4 ++-- src/Identity/UI/src/Microsoft.AspNetCore.Identity.UI.csproj | 1 - 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Identity/UI/ref/Microsoft.AspNetCore.Identity.UI.csproj b/src/Identity/UI/ref/Microsoft.AspNetCore.Identity.UI.csproj index 51b7eca6c4..813c7c4dff 100644 --- a/src/Identity/UI/ref/Microsoft.AspNetCore.Identity.UI.csproj +++ b/src/Identity/UI/ref/Microsoft.AspNetCore.Identity.UI.csproj @@ -5,7 +5,6 @@ - diff --git a/src/Identity/UI/src/Areas/Identity/Pages/V3/Account/Manage/DownloadPersonalData.cshtml.cs b/src/Identity/UI/src/Areas/Identity/Pages/V3/Account/Manage/DownloadPersonalData.cshtml.cs index 5152d01e35..d0fdadaf93 100644 --- a/src/Identity/UI/src/Areas/Identity/Pages/V3/Account/Manage/DownloadPersonalData.cshtml.cs +++ b/src/Identity/UI/src/Areas/Identity/Pages/V3/Account/Manage/DownloadPersonalData.cshtml.cs @@ -5,11 +5,11 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; +using System.Text.Json; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.Extensions.Logging; -using Newtonsoft.Json; namespace Microsoft.AspNetCore.Identity.UI.V3.Pages.Account.Manage.Internal { @@ -79,7 +79,7 @@ namespace Microsoft.AspNetCore.Identity.UI.V3.Pages.Account.Manage.Internal personalData.Add($"Authenticator Key", await _userManager.GetAuthenticatorKeyAsync(user)); Response.Headers.Add("Content-Disposition", "attachment; filename=PersonalData.json"); - return new FileContentResult(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(personalData)), "text/json"); + return new FileContentResult(JsonSerializer.SerializeToUtf8Bytes(personalData), "application/json"); } } } diff --git a/src/Identity/UI/src/Areas/Identity/Pages/V4/Account/Manage/DownloadPersonalData.cshtml.cs b/src/Identity/UI/src/Areas/Identity/Pages/V4/Account/Manage/DownloadPersonalData.cshtml.cs index 8529e3b171..38d077f014 100644 --- a/src/Identity/UI/src/Areas/Identity/Pages/V4/Account/Manage/DownloadPersonalData.cshtml.cs +++ b/src/Identity/UI/src/Areas/Identity/Pages/V4/Account/Manage/DownloadPersonalData.cshtml.cs @@ -5,11 +5,11 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; +using System.Text.Json; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.Extensions.Logging; -using Newtonsoft.Json; namespace Microsoft.AspNetCore.Identity.UI.V4.Pages.Account.Manage.Internal { @@ -79,7 +79,7 @@ namespace Microsoft.AspNetCore.Identity.UI.V4.Pages.Account.Manage.Internal personalData.Add($"Authenticator Key", await _userManager.GetAuthenticatorKeyAsync(user)); Response.Headers.Add("Content-Disposition", "attachment; filename=PersonalData.json"); - return new FileContentResult(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(personalData)), "text/json"); + return new FileContentResult(JsonSerializer.SerializeToUtf8Bytes(personalData), "application/json"); } } } diff --git a/src/Identity/UI/src/Microsoft.AspNetCore.Identity.UI.csproj b/src/Identity/UI/src/Microsoft.AspNetCore.Identity.UI.csproj index d803f42f5a..f5a122a355 100644 --- a/src/Identity/UI/src/Microsoft.AspNetCore.Identity.UI.csproj +++ b/src/Identity/UI/src/Microsoft.AspNetCore.Identity.UI.csproj @@ -36,7 +36,6 @@ - From 74360c7d97f9b55b94fecbd6e0598daf0c1b7cd1 Mon Sep 17 00:00:00 2001 From: Brennan Date: Tue, 22 Oct 2019 20:40:15 -0700 Subject: [PATCH 22/24] Fix a couple things in Typescript client (#13863) --- .../clients/ts/signalr/src/HttpConnection.ts | 8 +-- .../ts/signalr/src/WebSocketTransport.ts | 6 +- .../ts/signalr/tests/HttpConnection.test.ts | 58 +++++++++++++++++-- .../signalr/tests/WebSocketTransport.test.ts | 30 ++++++++++ 4 files changed, 92 insertions(+), 10 deletions(-) diff --git a/src/SignalR/clients/ts/signalr/src/HttpConnection.ts b/src/SignalR/clients/ts/signalr/src/HttpConnection.ts index 3359f253a9..27bb40b786 100644 --- a/src/SignalR/clients/ts/signalr/src/HttpConnection.ts +++ b/src/SignalR/clients/ts/signalr/src/HttpConnection.ts @@ -322,7 +322,7 @@ export class HttpConnection implements IConnection { }); if (response.statusCode !== 200) { - return Promise.reject(new Error(`Unexpected status code returned from negotiate ${response.statusCode}`)); + return Promise.reject(new Error(`Unexpected status code returned from negotiate '${response.statusCode}'`)); } const negotiateResponse = JSON.parse(response.content as string) as INegotiateResponse; @@ -475,8 +475,8 @@ export class HttpConnection implements IConnection { } if (this.connectionState === ConnectionState.Connecting) { - this.logger.log(LogLevel.Warning, `Call to HttpConnection.stopConnection(${error}) was ignored because the connection hasn't yet left the in the connecting state.`); - return; + this.logger.log(LogLevel.Warning, `Call to HttpConnection.stopConnection(${error}) was ignored because the connection is still in the connecting state.`); + throw new Error(`HttpConnection.stopConnection(${error}) was called while the connection is still in the connecting state.`); } if (this.connectionState === ConnectionState.Disconnecting) { @@ -626,7 +626,7 @@ export class TransportSendQueue { offset += item.byteLength; } - return result; + return result.buffer; } } diff --git a/src/SignalR/clients/ts/signalr/src/WebSocketTransport.ts b/src/SignalR/clients/ts/signalr/src/WebSocketTransport.ts index 1354a7e72d..00380686f8 100644 --- a/src/SignalR/clients/ts/signalr/src/WebSocketTransport.ts +++ b/src/SignalR/clients/ts/signalr/src/WebSocketTransport.ts @@ -105,7 +105,11 @@ export class WebSocketTransport implements ITransport { } }; - webSocket.onclose = (event: CloseEvent) => this.close(event); + webSocket.onclose = (event: CloseEvent) => { + if (this.webSocket) { + this.close(event); + } + }; }); } diff --git a/src/SignalR/clients/ts/signalr/tests/HttpConnection.test.ts b/src/SignalR/clients/ts/signalr/tests/HttpConnection.test.ts index 6ed2a6e78c..3e0b6a81eb 100644 --- a/src/SignalR/clients/ts/signalr/tests/HttpConnection.test.ts +++ b/src/SignalR/clients/ts/signalr/tests/HttpConnection.test.ts @@ -8,6 +8,7 @@ import { HttpTransportType, ITransport, TransferFormat } from "../src/ITransport import { getUserAgentHeader } from "../src/Utils"; import { HttpError } from "../src/Errors"; +import { ILogger, LogLevel } from "../src/ILogger"; import { NullLogger } from "../src/Loggers"; import { EventSourceConstructor, WebSocketConstructor } from "../src/Polyfills"; @@ -192,9 +193,9 @@ describe("HttpConnection", () => { const connection = new HttpConnection("http://tempuri.org", options); await expect(connection.start(TransferFormat.Text)) .rejects - .toThrow("Unexpected status code returned from negotiate 999"); + .toThrow("Unexpected status code returned from negotiate '999'"); }, - "Failed to start the connection: Error: Unexpected status code returned from negotiate 999"); + "Failed to start the connection: Error: Unexpected status code returned from negotiate '999'"); }); it("all transport failure errors get aggregated", async () => { @@ -1151,6 +1152,53 @@ describe("HttpConnection", () => { }, "Failed to start the connection: Error: nope"); }); + it("logMessageContent displays correctly with binary data", async () => { + await VerifyLogger.run(async (logger) => { + const availableTransport = { transport: "LongPolling", transferFormats: ["Text", "Binary"] }; + + let sentMessage = ""; + const captureLogger: ILogger = { + log: (logLevel: LogLevel, message: string) => { + if (logLevel === LogLevel.Trace && message.search("data of length") > 0) { + sentMessage = message; + } + + logger.log(logLevel, message); + }, + }; + + let httpClientGetCount = 0; + const options: IHttpConnectionOptions = { + ...commonOptions, + httpClient: new TestHttpClient() + .on("POST", () => ({ connectionId: "42", availableTransports: [availableTransport] })) + .on("GET", () => { + httpClientGetCount++; + if (httpClientGetCount === 1) { + // First long polling request must succeed so start completes + return ""; + } + return Promise.resolve(); + }) + .on("DELETE", () => new HttpResponse(202)), + logMessageContent: true, + logger: captureLogger, + transport: HttpTransportType.LongPolling, + } as IHttpConnectionOptions; + + const connection = new HttpConnection("http://tempuri.org", options); + connection.onreceive = () => null; + try { + await connection.start(TransferFormat.Binary); + await connection.send(new Uint8Array([0x68, 0x69, 0x20, 0x3a, 0x29])); + } finally { + await connection.stop(); + } + + expect(sentMessage).toBe("(LongPolling transport) sending data. Binary data of length 5. Content: '0x68 0x69 0x20 0x3a 0x29'."); + }); + }); + describe(".constructor", () => { it("throws if no Url is provided", async () => { // Force TypeScript to let us call the constructor incorrectly :) @@ -1413,7 +1461,7 @@ describe("TransportSendQueue", () => { const queue = new TransportSendQueue(transport); - const first = queue.send(new Uint8Array([4, 5, 6])); + const first = queue.send(new Uint8Array([4, 5, 6]).buffer); // This should allow first to enter transport.send promiseSource1.resolve(); // Wait until we're inside transport.send @@ -1428,8 +1476,8 @@ describe("TransportSendQueue", () => { await Promise.all([first, second, third]); expect(sendMock.mock.calls.length).toBe(2); - expect(sendMock.mock.calls[0][0]).toEqual(new Uint8Array([4, 5, 6])); - expect(sendMock.mock.calls[1][0]).toEqual(new Uint8Array([7, 8, 10, 12, 14])); + expect(sendMock.mock.calls[0][0]).toEqual(new Uint8Array([4, 5, 6]).buffer); + expect(sendMock.mock.calls[1][0]).toEqual(new Uint8Array([7, 8, 10, 12, 14]).buffer); await queue.stop(); }); diff --git a/src/SignalR/clients/ts/signalr/tests/WebSocketTransport.test.ts b/src/SignalR/clients/ts/signalr/tests/WebSocketTransport.test.ts index 7fae4c65ae..c28c77e8d0 100644 --- a/src/SignalR/clients/ts/signalr/tests/WebSocketTransport.test.ts +++ b/src/SignalR/clients/ts/signalr/tests/WebSocketTransport.test.ts @@ -259,6 +259,36 @@ describe("WebSocketTransport", () => { .toBe("WebSocket is not in the OPEN state"); }); }); + + it("does not run onclose callback if Transport does not fully connect and exits", async () => { + await VerifyLogger.run(async (logger) => { + (global as any).ErrorEvent = TestErrorEvent; + const webSocket = new WebSocketTransport(new TestHttpClient(), undefined, logger, true, TestWebSocket); + + const connectPromise = webSocket.connect("http://example.com", TransferFormat.Text); + + await TestWebSocket.webSocket.closeSet; + + let closeCalled: boolean = false; + let error: Error; + webSocket.onclose = (e) => { + closeCalled = true; + error = e!; + }; + + const message = new TestCloseEvent(); + message.wasClean = false; + message.code = 1; + message.reason = "just cause"; + TestWebSocket.webSocket.onclose(message); + + expect(closeCalled).toBe(false); + expect(error!).toBeUndefined(); + + TestWebSocket.webSocket.onerror(new TestEvent()); + await expect(connectPromise).rejects.toThrow("There was an error with the transport."); + }); + }); }); async function createAndStartWebSocket(logger: ILogger, url?: string, accessTokenFactory?: (() => string | Promise), format?: TransferFormat): Promise { From e6c9912ec5e6de72e7b8309b18fa7ddb1482a6ad Mon Sep 17 00:00:00 2001 From: Patrick Westerhoff Date: Sun, 20 Oct 2019 22:22:55 +0200 Subject: [PATCH 23/24] Render sections asynchronously in templates (#13091) --- .../content/RazorPagesWeb-CSharp/Pages/Shared/_Layout.cshtml | 2 +- .../content/StarterWeb-CSharp/Views/Shared/_Layout.cshtml | 2 +- .../content/StarterWeb-FSharp/Views/Shared/_Layout.cshtml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Shared/_Layout.cshtml b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Shared/_Layout.cshtml index ccc07b30f6..835d806c2e 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Shared/_Layout.cshtml +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Shared/_Layout.cshtml @@ -50,6 +50,6 @@ - @RenderSection("Scripts", required: false) + @await RenderSectionAsync("Scripts", required: false) diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Views/Shared/_Layout.cshtml b/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Views/Shared/_Layout.cshtml index 892d6b9b5d..5234625f8d 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Views/Shared/_Layout.cshtml +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Views/Shared/_Layout.cshtml @@ -48,6 +48,6 @@ - @RenderSection("Scripts", required: false) + @await RenderSectionAsync("Scripts", required: false) diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-FSharp/Views/Shared/_Layout.cshtml b/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-FSharp/Views/Shared/_Layout.cshtml index 6dbe6964a7..b326cdff07 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-FSharp/Views/Shared/_Layout.cshtml +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-FSharp/Views/Shared/_Layout.cshtml @@ -47,6 +47,6 @@ - @RenderSection("Scripts", required: false) + @await RenderSectionAsync("Scripts", required: false) From 97db4938f7dfd7ecee6bbd83c7b542fb0711bf5e Mon Sep 17 00:00:00 2001 From: Brennan Date: Wed, 23 Oct 2019 12:45:43 -0700 Subject: [PATCH 24/24] Remove flaky test (#15269) --- .../test/FunctionalTests/ServerTests.cs | 29 ------------------- 1 file changed, 29 deletions(-) diff --git a/src/Servers/HttpSys/test/FunctionalTests/ServerTests.cs b/src/Servers/HttpSys/test/FunctionalTests/ServerTests.cs index 1816fdcc28..04228c6da6 100644 --- a/src/Servers/HttpSys/test/FunctionalTests/ServerTests.cs +++ b/src/Servers/HttpSys/test/FunctionalTests/ServerTests.cs @@ -345,10 +345,6 @@ namespace Microsoft.AspNetCore.Server.HttpSys Assert.Equal(HttpStatusCode.ServiceUnavailable, response.StatusCode); } } - - // A connection has been closed, try again. - string responseText = await SendRequestAsync(address); - Assert.Equal(string.Empty, responseText); } } } @@ -366,31 +362,6 @@ namespace Microsoft.AspNetCore.Server.HttpSys } } - [ConditionalFact] - public async Task Server_SetConnectionLimit_Success() - { - using (Utilities.CreateDynamicHost(out var address, options => - { - Assert.Null(options.MaxConnections); - options.MaxConnections = 3; - }, httpContext => Task.FromResult(0))) - { - using (var client1 = await SendHungRequestAsync("GET", address)) - using (var client2 = await SendHungRequestAsync("GET", address)) - { - using (var client3 = await SendHungRequestAsync("GET", address)) - { - // Maxed out, refuses connection and throws - await Assert.ThrowsAsync(() => SendRequestAsync(address)); - } - - // A connection has been closed, try again. - string responseText = await SendRequestAsync(address); - Assert.Equal(string.Empty, responseText); - } - } - } - [ConditionalFact] public async Task Server_SetConnectionLimitChangeAfterStarted_Success() {