From 1c126ab773059d6a5899fc29547cb86ed49c46bf Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Mon, 1 Jul 2019 08:22:05 -0700 Subject: [PATCH] Get rid of pubternal in routing The only pubternal that remains is DfaGraphWriter - it's a good use case for pubternal because it's something we want to expose, but we'd never service and would willingly break the API in the future. It's also really unlikly that anyone would build on top of it. --- ...rosoft.AspNetCore.Routing.netcoreapp3.0.cs | 39 ++----------------- ...ointRoutingApplicationBuilderExtensions.cs | 1 - .../src/Builder/RoutingBuilderExtensions.cs | 3 +- .../src/DefaultInlineConstraintResolver.cs | 1 - src/Http/Routing/src/DefaultLinkGenerator.cs | 1 - .../src/DefaultParameterPolicyFactory.cs | 3 +- .../RoutingServiceCollectionExtensions.cs | 2 - .../src/Patterns/RouteParameterParser.cs | 3 +- .../src/Patterns/RoutePatternMatcher.cs | 1 - src/Http/Routing/src/RouteBase.cs | 2 - src/Http/Routing/src/RouteBuilder.cs | 3 +- .../Routing/src/RouteConstraintBuilder.cs | 1 - .../Routing/src/RouteValuesAddressScheme.cs | 1 - .../src/{Internal => }/SegmentState.cs | 7 +--- .../Template/DefaultTemplateBinderFactory.cs | 7 ---- .../Routing/src/Template/TemplateBinder.cs | 21 +--------- src/Http/Routing/src/Tree/TreeEnumerator.cs | 3 +- src/Http/Routing/src/Tree/TreeRouteBuilder.cs | 10 +---- src/Http/Routing/src/Tree/TreeRouter.cs | 6 +-- .../UriBuilderContextPooledObjectPolicy.cs | 3 -- .../src/{Internal => }/UriBuildingContext.cs | 6 +-- .../UnitTests/Internal/DfaGraphWriterTest.cs | 1 - .../test/UnitTests/LinkGeneratorTestBase.cs | 3 -- .../Matching/TreeRouterMatcherBuilder.cs | 3 -- .../{Internal => }/PathTokenizerTest.cs | 2 +- .../test/UnitTests/RouteBuilderTest.cs | 1 - src/Http/Routing/test/UnitTests/RouteTest.cs | 2 - .../UnitTests/RouteValuesAddressSchemeTest.cs | 2 - .../UnitTests/Template/TemplateBinderTests.cs | 3 -- .../TemplateParserDefaultValuesTests.cs | 2 - .../LinkGenerationDecisionTreeTest.cs | 3 +- .../UnitTests/Tree/TreeRouteBuilderTest.cs | 4 -- .../test/UnitTests/Tree/TreeRouterTest.cs | 6 --- .../{Internal => }/UriBuildingContextTest.cs | 4 +- 34 files changed, 19 insertions(+), 141 deletions(-) rename src/Http/Routing/src/{Internal => }/SegmentState.cs (80%) rename src/Http/Routing/src/{Internal => }/UriBuildingContext.cs (98%) rename src/Http/Routing/test/UnitTests/{Internal => }/PathTokenizerTest.cs (98%) rename src/Http/Routing/test/UnitTests/{Internal => Tree}/LinkGenerationDecisionTreeTest.cs (99%) rename src/Http/Routing/test/UnitTests/{Internal => }/UriBuildingContextTest.cs (95%) diff --git a/src/Http/Routing/ref/Microsoft.AspNetCore.Routing.netcoreapp3.0.cs b/src/Http/Routing/ref/Microsoft.AspNetCore.Routing.netcoreapp3.0.cs index cd5eabe1a7..81f59873b9 100644 --- a/src/Http/Routing/ref/Microsoft.AspNetCore.Routing.netcoreapp3.0.cs +++ b/src/Http/Routing/ref/Microsoft.AspNetCore.Routing.netcoreapp3.0.cs @@ -497,34 +497,6 @@ namespace Microsoft.AspNetCore.Routing.Internal public DfaGraphWriter(System.IServiceProvider services) { } public void Write(Microsoft.AspNetCore.Routing.EndpointDataSource dataSource, System.IO.TextWriter writer) { } } - [System.ObsoleteAttribute("This type will be marked as internal in a future release.")] - public enum SegmentState - { - Beginning = 0, - Inside = 1, - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerToString(),nq}")] - [System.ObsoleteAttribute("This type will be marked as internal in a future release.")] - public partial class UriBuildingContext - { - public UriBuildingContext(System.Text.Encodings.Web.UrlEncoder urlEncoder) { } - public bool AppendTrailingSlash { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public Microsoft.AspNetCore.Routing.Internal.SegmentState BufferState { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public bool LowercaseQueryStrings { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public bool LowercaseUrls { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public System.IO.TextWriter PathWriter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.IO.TextWriter QueryWriter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public Microsoft.AspNetCore.Routing.Internal.SegmentState UriState { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public bool Accept(string value) { throw null; } - public bool Accept(string value, bool encodeSlashes) { throw null; } - public bool Buffer(string value) { throw null; } - public void Clear() { } - public void EndSegment() { } - public void Remove(string literal) { } - public Microsoft.AspNetCore.Http.PathString ToPathString() { throw null; } - public Microsoft.AspNetCore.Http.QueryString ToQueryString() { throw null; } - public override string ToString() { throw null; } - } } namespace Microsoft.AspNetCore.Routing.Matching { @@ -767,10 +739,7 @@ namespace Microsoft.AspNetCore.Routing.Template } public partial class TemplateBinder { - [System.ObsoleteAttribute("This constructor is obsolete and will be marked internal in a future release. Use the TemplateBinderFactory service to create TemplateBinder instances.")] - public TemplateBinder(System.Text.Encodings.Web.UrlEncoder urlEncoder, Microsoft.Extensions.ObjectPool.ObjectPool pool, Microsoft.AspNetCore.Routing.Patterns.RoutePattern pattern, Microsoft.AspNetCore.Routing.RouteValueDictionary defaults, System.Collections.Generic.IEnumerable requiredKeys, System.Collections.Generic.IEnumerable> parameterPolicies) { } - [System.ObsoleteAttribute("This constructor is obsolete and will be marked internal in a furture release. Use the TemplateBinderFactory service to create TemplateBinder instances.")] - public TemplateBinder(System.Text.Encodings.Web.UrlEncoder urlEncoder, Microsoft.Extensions.ObjectPool.ObjectPool pool, Microsoft.AspNetCore.Routing.Template.RouteTemplate template, Microsoft.AspNetCore.Routing.RouteValueDictionary defaults) { } + internal TemplateBinder() { } public string BindValues(Microsoft.AspNetCore.Routing.RouteValueDictionary acceptedValues) { throw null; } public Microsoft.AspNetCore.Routing.Template.TemplateValuesResult GetValues(Microsoft.AspNetCore.Routing.RouteValueDictionary ambientValues, Microsoft.AspNetCore.Routing.RouteValueDictionary values) { throw null; } public static bool RoutePartsEqual(object a, object b) { throw null; } @@ -868,8 +837,7 @@ namespace Microsoft.AspNetCore.Routing.Tree } public partial class TreeRouteBuilder { - [System.ObsoleteAttribute("This constructor will be marked internal in a future release. Use the service provider to create instances of TreeRouteBuilder.")] - public TreeRouteBuilder(Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, Microsoft.Extensions.ObjectPool.ObjectPool objectPool, Microsoft.AspNetCore.Routing.IInlineConstraintResolver constraintResolver) { } + internal TreeRouteBuilder() { } public System.Collections.Generic.IList InboundEntries { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public System.Collections.Generic.IList OutboundEntries { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public Microsoft.AspNetCore.Routing.Tree.TreeRouter Build() { throw null; } @@ -880,9 +848,8 @@ namespace Microsoft.AspNetCore.Routing.Tree } public partial class TreeRouter : Microsoft.AspNetCore.Routing.IRouter { + internal TreeRouter() { } public static readonly string RouteGroupKey; - [System.ObsoleteAttribute("This constructor will be marked obsolete in a future release. Use the TreeRouterBuilder to create instances of TreeRouter.")] - public TreeRouter(Microsoft.AspNetCore.Routing.Tree.UrlMatchingTree[] trees, System.Collections.Generic.IEnumerable linkGenerationEntries, System.Text.Encodings.Web.UrlEncoder urlEncoder, Microsoft.Extensions.ObjectPool.ObjectPool objectPool, Microsoft.Extensions.Logging.ILogger routeLogger, Microsoft.Extensions.Logging.ILogger constraintLogger, int version) { } public int Version { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public Microsoft.AspNetCore.Routing.VirtualPathData GetVirtualPath(Microsoft.AspNetCore.Routing.VirtualPathContext context) { throw null; } [System.Diagnostics.DebuggerStepThroughAttribute] diff --git a/src/Http/Routing/src/Builder/EndpointRoutingApplicationBuilderExtensions.cs b/src/Http/Routing/src/Builder/EndpointRoutingApplicationBuilderExtensions.cs index b60a87c432..d1d3617210 100644 --- a/src/Http/Routing/src/Builder/EndpointRoutingApplicationBuilderExtensions.cs +++ b/src/Http/Routing/src/Builder/EndpointRoutingApplicationBuilderExtensions.cs @@ -4,7 +4,6 @@ using System; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing; -using Microsoft.AspNetCore.Routing.Internal; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; diff --git a/src/Http/Routing/src/Builder/RoutingBuilderExtensions.cs b/src/Http/Routing/src/Builder/RoutingBuilderExtensions.cs index cc2e2457e8..133708370c 100644 --- a/src/Http/Routing/src/Builder/RoutingBuilderExtensions.cs +++ b/src/Http/Routing/src/Builder/RoutingBuilderExtensions.cs @@ -3,7 +3,6 @@ using System; using Microsoft.AspNetCore.Routing; -using Microsoft.AspNetCore.Routing.Internal; using Microsoft.Extensions.DependencyInjection; namespace Microsoft.AspNetCore.Builder @@ -75,4 +74,4 @@ namespace Microsoft.AspNetCore.Builder return builder.UseRouter(routeBuilder.Build()); } } -} \ No newline at end of file +} diff --git a/src/Http/Routing/src/DefaultInlineConstraintResolver.cs b/src/Http/Routing/src/DefaultInlineConstraintResolver.cs index 7411fe485b..d70825f57b 100644 --- a/src/Http/Routing/src/DefaultInlineConstraintResolver.cs +++ b/src/Http/Routing/src/DefaultInlineConstraintResolver.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using Microsoft.AspNetCore.Routing.Internal; using Microsoft.Extensions.Options; namespace Microsoft.AspNetCore.Routing diff --git a/src/Http/Routing/src/DefaultLinkGenerator.cs b/src/Http/Routing/src/DefaultLinkGenerator.cs index aae057a3ac..d90a5f26df 100644 --- a/src/Http/Routing/src/DefaultLinkGenerator.cs +++ b/src/Http/Routing/src/DefaultLinkGenerator.cs @@ -10,7 +10,6 @@ using System.Text.Encodings.Web; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Extensions; using Microsoft.AspNetCore.Http.Features; -using Microsoft.AspNetCore.Routing.Internal; using Microsoft.AspNetCore.Routing.Template; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; diff --git a/src/Http/Routing/src/DefaultParameterPolicyFactory.cs b/src/Http/Routing/src/DefaultParameterPolicyFactory.cs index d1837c91c2..1982d75518 100644 --- a/src/Http/Routing/src/DefaultParameterPolicyFactory.cs +++ b/src/Http/Routing/src/DefaultParameterPolicyFactory.cs @@ -1,9 +1,8 @@ -// 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; using Microsoft.AspNetCore.Routing.Constraints; -using Microsoft.AspNetCore.Routing.Internal; using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.Extensions.Options; diff --git a/src/Http/Routing/src/DependencyInjection/RoutingServiceCollectionExtensions.cs b/src/Http/Routing/src/DependencyInjection/RoutingServiceCollectionExtensions.cs index cc61b3e490..9c774b4168 100644 --- a/src/Http/Routing/src/DependencyInjection/RoutingServiceCollectionExtensions.cs +++ b/src/Http/Routing/src/DependencyInjection/RoutingServiceCollectionExtensions.cs @@ -35,7 +35,6 @@ namespace Microsoft.Extensions.DependencyInjection services.TryAddTransient(); services.TryAddTransient(); -#pragma warning disable CS0618 // Type or member is obsolete services.TryAddSingleton>(s => { var provider = s.GetRequiredService(); @@ -51,7 +50,6 @@ namespace Microsoft.Extensions.DependencyInjection var constraintResolver = s.GetRequiredService(); return new TreeRouteBuilder(loggerFactory, objectPool, constraintResolver); })); -#pragma warning restore CS0618 // Type or member is obsolete services.TryAddSingleton(typeof(RoutingMarkerService)); diff --git a/src/Http/Routing/src/Patterns/RouteParameterParser.cs b/src/Http/Routing/src/Patterns/RouteParameterParser.cs index 0cb7e48989..07c8d91bb9 100644 --- a/src/Http/Routing/src/Patterns/RouteParameterParser.cs +++ b/src/Http/Routing/src/Patterns/RouteParameterParser.cs @@ -2,7 +2,6 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using Microsoft.AspNetCore.Routing.Internal; namespace Microsoft.AspNetCore.Routing.Patterns { @@ -256,4 +255,4 @@ namespace Microsoft.AspNetCore.Routing.Patterns } } } -} \ No newline at end of file +} diff --git a/src/Http/Routing/src/Patterns/RoutePatternMatcher.cs b/src/Http/Routing/src/Patterns/RoutePatternMatcher.cs index bb35818703..15bc489a64 100644 --- a/src/Http/Routing/src/Patterns/RoutePatternMatcher.cs +++ b/src/Http/Routing/src/Patterns/RoutePatternMatcher.cs @@ -4,7 +4,6 @@ using System; using System.Diagnostics; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing.Internal; using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.Extensions.Primitives; diff --git a/src/Http/Routing/src/RouteBase.cs b/src/Http/Routing/src/RouteBase.cs index 75d393a5d4..c4b86692ff 100644 --- a/src/Http/Routing/src/RouteBase.cs +++ b/src/Http/Routing/src/RouteBase.cs @@ -245,7 +245,6 @@ namespace Microsoft.AspNetCore.Routing } } -#pragma warning disable CS0618 // Type or member is obsolete private void EnsureBinder(HttpContext context) { if (_binder == null) @@ -254,7 +253,6 @@ namespace Microsoft.AspNetCore.Routing _binder = binderFactory.Create(ParsedTemplate, Defaults); } } -#pragma warning restore CS0618 // Type or member is obsolete private void EnsureLoggers(HttpContext context) { diff --git a/src/Http/Routing/src/RouteBuilder.cs b/src/Http/Routing/src/RouteBuilder.cs index b492bfb59e..8899aa6e9a 100644 --- a/src/Http/Routing/src/RouteBuilder.cs +++ b/src/Http/Routing/src/RouteBuilder.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Routing.Internal; using Microsoft.Extensions.DependencyInjection; namespace Microsoft.AspNetCore.Routing @@ -58,4 +57,4 @@ namespace Microsoft.AspNetCore.Routing return routeCollection; } } -} \ No newline at end of file +} diff --git a/src/Http/Routing/src/RouteConstraintBuilder.cs b/src/Http/Routing/src/RouteConstraintBuilder.cs index 5bb40282a6..14c4e12f3c 100644 --- a/src/Http/Routing/src/RouteConstraintBuilder.cs +++ b/src/Http/Routing/src/RouteConstraintBuilder.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using Microsoft.AspNetCore.Routing.Constraints; -using Microsoft.AspNetCore.Routing.Internal; namespace Microsoft.AspNetCore.Routing { diff --git a/src/Http/Routing/src/RouteValuesAddressScheme.cs b/src/Http/Routing/src/RouteValuesAddressScheme.cs index 360c253f73..3d0db2b0f9 100644 --- a/src/Http/Routing/src/RouteValuesAddressScheme.cs +++ b/src/Http/Routing/src/RouteValuesAddressScheme.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing.Internal; using Microsoft.AspNetCore.Routing.Template; using Microsoft.AspNetCore.Routing.Tree; diff --git a/src/Http/Routing/src/Internal/SegmentState.cs b/src/Http/Routing/src/SegmentState.cs similarity index 80% rename from src/Http/Routing/src/Internal/SegmentState.cs rename to src/Http/Routing/src/SegmentState.cs index 6431f01059..b9d05738c9 100644 --- a/src/Http/Routing/src/Internal/SegmentState.cs +++ b/src/Http/Routing/src/SegmentState.cs @@ -1,9 +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; - -namespace Microsoft.AspNetCore.Routing.Internal +namespace Microsoft.AspNetCore.Routing { // Segments are treated as all-or-none. We should never output a partial segment. // If we add any subsegment of this segment to the generated URI, we have to add @@ -11,8 +9,7 @@ namespace Microsoft.AspNetCore.Routing.Internal // used a value for {p1}, we have to output the entire segment up to the next "/". // Otherwise we could end up with the partial segment "v1" instead of the entire // segment "v1-v2.xml". - [Obsolete("This type will be marked as internal in a future release.")] - public enum SegmentState + internal enum SegmentState { Beginning, Inside, diff --git a/src/Http/Routing/src/Template/DefaultTemplateBinderFactory.cs b/src/Http/Routing/src/Template/DefaultTemplateBinderFactory.cs index 86e33e04a3..b2583d7bb1 100644 --- a/src/Http/Routing/src/Template/DefaultTemplateBinderFactory.cs +++ b/src/Http/Routing/src/Template/DefaultTemplateBinderFactory.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Text.Encodings.Web; -using Microsoft.AspNetCore.Routing.Internal; using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.Extensions.ObjectPool; @@ -13,15 +12,11 @@ namespace Microsoft.AspNetCore.Routing.Template internal sealed class DefaultTemplateBinderFactory : TemplateBinderFactory { private readonly ParameterPolicyFactory _policyFactory; -#pragma warning disable CS0618 // Type or member is obsolete private readonly ObjectPool _pool; -#pragma warning restore CS0618 // Type or member is obsolete public DefaultTemplateBinderFactory( ParameterPolicyFactory policyFactory, -#pragma warning disable CS0618 // Type or member is obsolete ObjectPool pool) -#pragma warning restore CS0618 // Type or member is obsolete { if (policyFactory == null) { @@ -50,9 +45,7 @@ namespace Microsoft.AspNetCore.Routing.Template throw new ArgumentNullException(nameof(defaults)); } -#pragma warning disable CS0618 // Type or member is obsolete return new TemplateBinder(UrlEncoder.Default, _pool, template, defaults); -#pragma warning restore CS0618 // Type or member is obsolete } public override TemplateBinder Create(RoutePattern pattern) diff --git a/src/Http/Routing/src/Template/TemplateBinder.cs b/src/Http/Routing/src/Template/TemplateBinder.cs index f3924f3c92..1d3cbd6dcc 100644 --- a/src/Http/Routing/src/Template/TemplateBinder.cs +++ b/src/Http/Routing/src/Template/TemplateBinder.cs @@ -10,7 +10,6 @@ using System.Linq; using System.Runtime.CompilerServices; using System.Text.Encodings.Web; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing.Internal; using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.Extensions.ObjectPool; @@ -19,9 +18,7 @@ namespace Microsoft.AspNetCore.Routing.Template public class TemplateBinder { private readonly UrlEncoder _urlEncoder; -#pragma warning disable CS0618 // Type or member is obsolete private readonly ObjectPool _pool; -#pragma warning restore CS0618 // Type or member is obsolete private readonly (string parameterName, IRouteConstraint constraint)[] _constraints; private readonly RouteValueDictionary _defaults; @@ -42,14 +39,9 @@ namespace Microsoft.AspNetCore.Routing.Template /// The . /// The to bind values to. /// The default values for . - [Obsolete( - "This constructor is obsolete and will be marked internal in a furture release. Use the TemplateBinderFactory service " + - "to create TemplateBinder instances.")] - public TemplateBinder( + internal TemplateBinder( UrlEncoder urlEncoder, -#pragma warning disable PUB0001 ObjectPool pool, -#pragma warning restore PUB0001 RouteTemplate template, RouteValueDictionary defaults) : this(urlEncoder, pool, template?.ToRoutePattern(), defaults, requiredKeys: null, parameterPolicies: null) @@ -67,14 +59,9 @@ namespace Microsoft.AspNetCore.Routing.Template /// /// A list of (, ) pairs to evalute when producing a URI. /// - [Obsolete( - "This constructor is obsolete and will be marked internal in a future release. Use the TemplateBinderFactory service " + - "to create TemplateBinder instances.")] - public TemplateBinder( + internal TemplateBinder( UrlEncoder urlEncoder, -#pragma warning disable PUB0001 ObjectPool pool, -#pragma warning restore PUB0001 RoutePattern pattern, RouteValueDictionary defaults, IEnumerable requiredKeys, @@ -124,9 +111,7 @@ namespace Microsoft.AspNetCore.Routing.Template internal TemplateBinder( UrlEncoder urlEncoder, -#pragma warning disable CS0618 // Type or member is obsolete ObjectPool pool, -#pragma warning restore CS0618 // Type or member is obsolete RoutePattern pattern, IEnumerable<(string parameterName, IParameterPolicy policy)> parameterPolicies) { @@ -506,7 +491,6 @@ namespace Microsoft.AspNetCore.Routing.Template } } -#pragma warning disable CS0618 // Type or member is obsolete private bool TryBindValuesCore(UriBuildingContext context, RouteValueDictionary acceptedValues) { // If we have any output parameter transformers, allow them a chance to influence the parameter values @@ -647,7 +631,6 @@ namespace Microsoft.AspNetCore.Routing.Template } return false; } -#pragma warning restore CS0618 // Type or member is obsolete /// /// Compares two objects for equality as parts of a case-insensitive path. diff --git a/src/Http/Routing/src/Tree/TreeEnumerator.cs b/src/Http/Routing/src/Tree/TreeEnumerator.cs index cdd7ec6f81..5a88f5bc35 100644 --- a/src/Http/Routing/src/Tree/TreeEnumerator.cs +++ b/src/Http/Routing/src/Tree/TreeEnumerator.cs @@ -1,10 +1,9 @@ -// 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.Collections; using System.Collections.Generic; using System.Diagnostics; -using Microsoft.AspNetCore.Routing.Internal; namespace Microsoft.AspNetCore.Routing.Tree { diff --git a/src/Http/Routing/src/Tree/TreeRouteBuilder.cs b/src/Http/Routing/src/Tree/TreeRouteBuilder.cs index 31024de23c..59e06d83c0 100644 --- a/src/Http/Routing/src/Tree/TreeRouteBuilder.cs +++ b/src/Http/Routing/src/Tree/TreeRouteBuilder.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text.Encodings.Web; -using Microsoft.AspNetCore.Routing.Internal; using Microsoft.AspNetCore.Routing.Template; using Microsoft.Extensions.Logging; using Microsoft.Extensions.ObjectPool; @@ -20,9 +19,7 @@ namespace Microsoft.AspNetCore.Routing.Tree private readonly ILogger _logger; private readonly ILogger _constraintLogger; private readonly UrlEncoder _urlEncoder; -#pragma warning disable CS0618 // Type or member is obsolete private readonly ObjectPool _objectPool; -#pragma warning restore CS0618 // Type or member is obsolete private readonly IInlineConstraintResolver _constraintResolver; /// @@ -31,12 +28,9 @@ namespace Microsoft.AspNetCore.Routing.Tree /// The . /// The . /// The . - [Obsolete("This constructor will be marked internal in a future release. Use the service provider to create instances of TreeRouteBuilder.")] - public TreeRouteBuilder( + internal TreeRouteBuilder( ILoggerFactory loggerFactory, -#pragma warning disable CS0618, PUB0001 // Type or member is obsolete ObjectPool objectPool, -#pragma warning restore CS0618, PUB0001 // Type or member is obsolete IInlineConstraintResolver constraintResolver) { if (loggerFactory == null) @@ -244,7 +238,6 @@ namespace Microsoft.AspNetCore.Routing.Tree tree.AddEntry(entry); } -#pragma warning disable CS0618 // Type or member is obsolete return new TreeRouter( trees.Values.OrderBy(tree => tree.Order).ToArray(), OutboundEntries, @@ -253,7 +246,6 @@ namespace Microsoft.AspNetCore.Routing.Tree _logger, _constraintLogger, version); -#pragma warning restore CS0618 // Type or member is obsolete } /// diff --git a/src/Http/Routing/src/Tree/TreeRouter.cs b/src/Http/Routing/src/Tree/TreeRouter.cs index 69b9b5085f..9dd6eb290b 100644 --- a/src/Http/Routing/src/Tree/TreeRouter.cs +++ b/src/Http/Routing/src/Tree/TreeRouter.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.Text.Encodings.Web; using System.Threading.Tasks; -using Microsoft.AspNetCore.Routing.Internal; using Microsoft.AspNetCore.Routing.Logging; using Microsoft.AspNetCore.Routing.Template; using Microsoft.Extensions.Logging; @@ -40,14 +39,11 @@ namespace Microsoft.AspNetCore.Routing.Tree /// The instance used /// in . /// The version of this route. - [Obsolete("This constructor will be marked obsolete in a future release. Use the TreeRouterBuilder to create instances of TreeRouter.")] - public TreeRouter( + internal TreeRouter( UrlMatchingTree[] trees, IEnumerable linkGenerationEntries, UrlEncoder urlEncoder, -#pragma warning disable CS0618, PUB0001 // Type or member is obsolete ObjectPool objectPool, -#pragma warning restore CS0618, PUB0001 // Type or member is obsolete ILogger routeLogger, ILogger constraintLogger, int version) diff --git a/src/Http/Routing/src/UriBuilderContextPooledObjectPolicy.cs b/src/Http/Routing/src/UriBuilderContextPooledObjectPolicy.cs index 7ed7021d1f..fdea6b7e64 100644 --- a/src/Http/Routing/src/UriBuilderContextPooledObjectPolicy.cs +++ b/src/Http/Routing/src/UriBuilderContextPooledObjectPolicy.cs @@ -2,12 +2,10 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Text.Encodings.Web; -using Microsoft.AspNetCore.Routing.Internal; using Microsoft.Extensions.ObjectPool; namespace Microsoft.AspNetCore.Routing { -#pragma warning disable CS0618 // Type or member is obsolete internal class UriBuilderContextPooledObjectPolicy : IPooledObjectPolicy { public UriBuildingContext Create() @@ -21,5 +19,4 @@ namespace Microsoft.AspNetCore.Routing return true; } } -#pragma warning restore CS0618 // Type or member is obsolete } diff --git a/src/Http/Routing/src/Internal/UriBuildingContext.cs b/src/Http/Routing/src/UriBuildingContext.cs similarity index 98% rename from src/Http/Routing/src/Internal/UriBuildingContext.cs rename to src/Http/Routing/src/UriBuildingContext.cs index dcfde1d866..974bcd8a1e 100644 --- a/src/Http/Routing/src/Internal/UriBuildingContext.cs +++ b/src/Http/Routing/src/UriBuildingContext.cs @@ -1,7 +1,6 @@ // 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.IO; @@ -9,11 +8,10 @@ using System.Text; using System.Text.Encodings.Web; using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.Routing.Internal +namespace Microsoft.AspNetCore.Routing { - [Obsolete("This type will be marked as internal in a future release.")] [DebuggerDisplay("{DebuggerToString(),nq}")] - public class UriBuildingContext + internal class UriBuildingContext { // Holds the 'accepted' parts of the path. private readonly StringBuilder _path; diff --git a/src/Http/Routing/test/UnitTests/Internal/DfaGraphWriterTest.cs b/src/Http/Routing/test/UnitTests/Internal/DfaGraphWriterTest.cs index 14efa64d36..59162faadf 100644 --- a/src/Http/Routing/test/UnitTests/Internal/DfaGraphWriterTest.cs +++ b/src/Http/Routing/test/UnitTests/Internal/DfaGraphWriterTest.cs @@ -6,7 +6,6 @@ using System.IO; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Primitives; using Xunit; namespace Microsoft.AspNetCore.Routing.Internal diff --git a/src/Http/Routing/test/UnitTests/LinkGeneratorTestBase.cs b/src/Http/Routing/test/UnitTests/LinkGeneratorTestBase.cs index 579a0000ae..e60379480f 100644 --- a/src/Http/Routing/test/UnitTests/LinkGeneratorTestBase.cs +++ b/src/Http/Routing/test/UnitTests/LinkGeneratorTestBase.cs @@ -3,12 +3,9 @@ using System; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Features; -using Microsoft.AspNetCore.Routing.Internal; using Microsoft.AspNetCore.Routing.Template; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging.Abstractions; -using Microsoft.Extensions.ObjectPool; using Microsoft.Extensions.Options; namespace Microsoft.AspNetCore.Routing diff --git a/src/Http/Routing/test/UnitTests/Matching/TreeRouterMatcherBuilder.cs b/src/Http/Routing/test/UnitTests/Matching/TreeRouterMatcherBuilder.cs index 6441e8369e..ad1da64fc6 100644 --- a/src/Http/Routing/test/UnitTests/Matching/TreeRouterMatcherBuilder.cs +++ b/src/Http/Routing/test/UnitTests/Matching/TreeRouterMatcherBuilder.cs @@ -7,7 +7,6 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; -using Microsoft.AspNetCore.Routing.Internal; using Microsoft.AspNetCore.Routing.Template; using Microsoft.AspNetCore.Routing.TestObjects; using Microsoft.AspNetCore.Routing.Tree; @@ -33,12 +32,10 @@ namespace Microsoft.AspNetCore.Routing.Matching public override Matcher Build() { -#pragma warning disable CS0618 // Type or member is obsolete var builder = new TreeRouteBuilder( NullLoggerFactory.Instance, new DefaultObjectPool(new UriBuilderContextPooledObjectPolicy()), new DefaultInlineConstraintResolver(Options.Create(new RouteOptions()), new TestServiceProvider())); -#pragma warning restore CS0618 // Type or member is obsolete var selector = new DefaultEndpointSelector(); diff --git a/src/Http/Routing/test/UnitTests/Internal/PathTokenizerTest.cs b/src/Http/Routing/test/UnitTests/PathTokenizerTest.cs similarity index 98% rename from src/Http/Routing/test/UnitTests/Internal/PathTokenizerTest.cs rename to src/Http/Routing/test/UnitTests/PathTokenizerTest.cs index 78b9685e63..fb16131979 100644 --- a/src/Http/Routing/test/UnitTests/Internal/PathTokenizerTest.cs +++ b/src/Http/Routing/test/UnitTests/PathTokenizerTest.cs @@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Primitives; using Xunit; -namespace Microsoft.AspNetCore.Routing.Internal +namespace Microsoft.AspNetCore.Routing { public class PathTokenizerTest { diff --git a/src/Http/Routing/test/UnitTests/RouteBuilderTest.cs b/src/Http/Routing/test/UnitTests/RouteBuilderTest.cs index edd3e09cba..609ae8db50 100644 --- a/src/Http/Routing/test/UnitTests/RouteBuilderTest.cs +++ b/src/Http/Routing/test/UnitTests/RouteBuilderTest.cs @@ -3,7 +3,6 @@ using System; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Routing.Internal; using Microsoft.Extensions.DependencyInjection; using Moq; using Xunit; diff --git a/src/Http/Routing/test/UnitTests/RouteTest.cs b/src/Http/Routing/test/UnitTests/RouteTest.cs index db7bce321e..16e7571e2e 100644 --- a/src/Http/Routing/test/UnitTests/RouteTest.cs +++ b/src/Http/Routing/test/UnitTests/RouteTest.cs @@ -8,13 +8,11 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing.Constraints; -using Microsoft.AspNetCore.Routing.Internal; using Microsoft.AspNetCore.Routing.TestObjects; using Microsoft.AspNetCore.Testing; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; -using Microsoft.Extensions.ObjectPool; using Microsoft.Extensions.Options; using Microsoft.Extensions.WebEncoders.Testing; using Moq; diff --git a/src/Http/Routing/test/UnitTests/RouteValuesAddressSchemeTest.cs b/src/Http/Routing/test/UnitTests/RouteValuesAddressSchemeTest.cs index 023b594465..3021062750 100644 --- a/src/Http/Routing/test/UnitTests/RouteValuesAddressSchemeTest.cs +++ b/src/Http/Routing/test/UnitTests/RouteValuesAddressSchemeTest.cs @@ -4,10 +4,8 @@ using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing.Internal; using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.AspNetCore.Routing.TestObjects; -using Microsoft.AspNetCore.Routing.Tree; using Xunit; namespace Microsoft.AspNetCore.Routing diff --git a/src/Http/Routing/test/UnitTests/Template/TemplateBinderTests.cs b/src/Http/Routing/test/UnitTests/Template/TemplateBinderTests.cs index 0ae7eb7e5b..00eafa490c 100644 --- a/src/Http/Routing/test/UnitTests/Template/TemplateBinderTests.cs +++ b/src/Http/Routing/test/UnitTests/Template/TemplateBinderTests.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Linq; using System.Text.Encodings.Web; using Microsoft.AspNetCore.Routing.Constraints; -using Microsoft.AspNetCore.Routing.Internal; using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.AspNetCore.Routing.TestObjects; using Microsoft.Extensions.DependencyInjection; @@ -16,7 +15,6 @@ using Xunit; namespace Microsoft.AspNetCore.Routing.Template.Tests { -#pragma warning disable CS0618 // Type or member is obsolete public class TemplateBinderTests { private readonly IInlineConstraintResolver _inlineConstraintResolver = GetInlineConstraintResolver(); @@ -1481,5 +1479,4 @@ namespace Microsoft.AspNetCore.Routing.Template.Tests public Dictionary Parameters { get; private set; } } } -#pragma warning restore CS0618 // Type or member is obsolete } diff --git a/src/Http/Routing/test/UnitTests/TemplateParserDefaultValuesTests.cs b/src/Http/Routing/test/UnitTests/TemplateParserDefaultValuesTests.cs index 92b2b1c120..2a5ae1f918 100644 --- a/src/Http/Routing/test/UnitTests/TemplateParserDefaultValuesTests.cs +++ b/src/Http/Routing/test/UnitTests/TemplateParserDefaultValuesTests.cs @@ -1,9 +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 Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Routing.Internal; using Microsoft.AspNetCore.Testing; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; diff --git a/src/Http/Routing/test/UnitTests/Internal/LinkGenerationDecisionTreeTest.cs b/src/Http/Routing/test/UnitTests/Tree/LinkGenerationDecisionTreeTest.cs similarity index 99% rename from src/Http/Routing/test/UnitTests/Internal/LinkGenerationDecisionTreeTest.cs rename to src/Http/Routing/test/UnitTests/Tree/LinkGenerationDecisionTreeTest.cs index b141386a68..3b6fd08b43 100644 --- a/src/Http/Routing/test/UnitTests/Internal/LinkGenerationDecisionTreeTest.cs +++ b/src/Http/Routing/test/UnitTests/Tree/LinkGenerationDecisionTreeTest.cs @@ -7,10 +7,9 @@ using System.Linq; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.AspNetCore.Routing.Template; -using Microsoft.AspNetCore.Routing.Tree; using Xunit; -namespace Microsoft.AspNetCore.Routing.Internal.Routing +namespace Microsoft.AspNetCore.Routing.Tree { public class LinkGenerationDecisionTreeTest { diff --git a/src/Http/Routing/test/UnitTests/Tree/TreeRouteBuilderTest.cs b/src/Http/Routing/test/UnitTests/Tree/TreeRouteBuilderTest.cs index 665e11f07e..f628187fa4 100644 --- a/src/Http/Routing/test/UnitTests/Tree/TreeRouteBuilderTest.cs +++ b/src/Http/Routing/test/UnitTests/Tree/TreeRouteBuilderTest.cs @@ -1,8 +1,6 @@ // 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.Text.Encodings.Web; -using Microsoft.AspNetCore.Routing.Internal; using Microsoft.AspNetCore.Routing.Template; using Microsoft.AspNetCore.Testing; using Microsoft.Extensions.DependencyInjection; @@ -248,12 +246,10 @@ namespace Microsoft.AspNetCore.Routing.Tree var objectPool = objectPoolProvider.Create(objectPolicy); var constraintResolver = GetInlineConstraintResolver(); -#pragma warning disable CS0618 // Type or member is obsolete var builder = new TreeRouteBuilder( NullLoggerFactory.Instance, objectPool, constraintResolver); -#pragma warning restore CS0618 // Type or member is obsolete return builder; } diff --git a/src/Http/Routing/test/UnitTests/Tree/TreeRouterTest.cs b/src/Http/Routing/test/UnitTests/Tree/TreeRouterTest.cs index d8bd30ae4f..0f9a2a7feb 100644 --- a/src/Http/Routing/test/UnitTests/Tree/TreeRouterTest.cs +++ b/src/Http/Routing/test/UnitTests/Tree/TreeRouterTest.cs @@ -4,10 +4,8 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text.Encodings.Web; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing.Internal; using Microsoft.AspNetCore.Routing.Template; using Microsoft.AspNetCore.Routing.TestObjects; using Microsoft.Extensions.Logging; @@ -23,10 +21,8 @@ namespace Microsoft.AspNetCore.Routing.Tree { private static readonly RequestDelegate NullHandler = (c) => Task.CompletedTask; -#pragma warning disable CS0618 // Type or member is obsolete private static ObjectPool Pool = new DefaultObjectPoolProvider().Create( new UriBuilderContextPooledObjectPolicy()); -#pragma warning restore CS0618 // Type or member is obsolete [Theory] [InlineData("template/5", "template/{parameter:int}")] @@ -2075,7 +2071,6 @@ namespace Microsoft.AspNetCore.Routing.Tree return new DefaultInlineConstraintResolver(optionsMock.Object, new TestServiceProvider()); } -#pragma warning disable CS0618 // Type or member is obsolete private static TreeRouteBuilder CreateBuilder() { var objectPoolProvider = new DefaultObjectPoolProvider(); @@ -2089,7 +2084,6 @@ namespace Microsoft.AspNetCore.Routing.Tree constraintResolver); return builder; } -#pragma warning restore CS0618 // Type or member is obsolete private static TreeRouter CreateTreeRouter( string firstTemplate, diff --git a/src/Http/Routing/test/UnitTests/Internal/UriBuildingContextTest.cs b/src/Http/Routing/test/UnitTests/UriBuildingContextTest.cs similarity index 95% rename from src/Http/Routing/test/UnitTests/Internal/UriBuildingContextTest.cs rename to src/Http/Routing/test/UnitTests/UriBuildingContextTest.cs index f9f0be2ab8..10aae56f21 100644 --- a/src/Http/Routing/test/UnitTests/Internal/UriBuildingContextTest.cs +++ b/src/Http/Routing/test/UnitTests/UriBuildingContextTest.cs @@ -4,9 +4,8 @@ using Microsoft.Extensions.WebEncoders.Testing; using Xunit; -namespace Microsoft.AspNetCore.Routing.Internal +namespace Microsoft.AspNetCore.Routing { -#pragma warning disable CS0618 // Type or member is obsolete public class UriBuildingContextTest { [Fact] @@ -98,5 +97,4 @@ namespace Microsoft.AspNetCore.Routing.Internal Assert.Equal(expected, uriBuilldingContext.ToPathString().Value); } } -#pragma warning restore CS0618 // Type or member is obsolete }