Skip to content

Commit 66fbf39

Browse files
committed
Cleanups
1 parent ae4037a commit 66fbf39

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

src/Components/Endpoints/test/RazorComponentEndpointDataSourceTest.cs

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
using Microsoft.AspNetCore.Components.Web;
88
using Microsoft.AspNetCore.Routing;
99
using Microsoft.AspNetCore.Routing.Patterns;
10-
//using Microsoft.AspNetCore.Routing.Patterns;
1110
using Microsoft.Extensions.DependencyInjection;
1211
using Microsoft.Extensions.DependencyInjection.Extensions;
1312

src/Http/Http.Abstractions/src/Routing/RouteValueDictionary.cs

+5-1
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,11 @@ private static void ValidatePropertyNames(Type type, PropertyHelper[] properties
902902

903903
if (names.TryGetValue(property.Name, out var duplicate))
904904
{
905-
var message = $"The type '{type.FullName}' defines properties '{property.Name}' and '{duplicate.Name}' which differ only by casing. This is not supported by {nameof(RouteValueDictionary)} which uses case-insensitive comparisons.";
905+
var message = Resources.FormatRouteValueDictionary_DuplicatePropertyName(
906+
type.FullName,
907+
property.Name,
908+
duplicate.Name,
909+
nameof(RouteValueDictionary));
906910
throw new InvalidOperationException(message);
907911
}
908912

src/Http/Routing/src/ParameterPolicyActivator.cs

+3-13
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
using System.Diagnostics.CodeAnalysis;
66
using System.Globalization;
77
using System.Reflection;
8+
#if COMPONENTS
9+
using Microsoft.AspNetCore.Components.Routing;
10+
#endif
811
using Microsoft.Extensions.DependencyInjection;
912

1013
namespace Microsoft.AspNetCore.Routing;
@@ -37,12 +40,8 @@ internal static class ParameterPolicyActivator
3740
{
3841
// Error if type is not a parameter policy
3942
throw new RouteCreationException(
40-
#if !COMPONENTS
4143
Resources.FormatDefaultInlineConstraintResolver_TypeNotConstraint(
4244
parameterPolicyType, parameterPolicyKey, typeof(T).Name));
43-
#else
44-
$"The constraint type '{parameterPolicyType}' which is mapped to constraint key '{parameterPolicyKey}' must implement the '{typeof(T).Name}' interface.");
45-
#endif
4645
}
4746

4847
// Return null if type is parameter policy but is not the exact type
@@ -122,12 +121,8 @@ private static IParameterPolicy CreateParameterPolicy(IServiceProvider? serviceP
122121
if (matchingConstructors.Count == 0)
123122
{
124123
throw new RouteCreationException(
125-
#if !COMPONENTS
126124
Resources.FormatDefaultInlineConstraintResolver_CouldNotFindCtor(
127125
parameterPolicyType.Name, arguments.Length));
128-
#else
129-
$"Could not find a constructor for constraint type '{parameterPolicyType.Name}' with the following number of parameters: {arguments.Length}.");
130-
#endif
131126
}
132127
else
133128
{
@@ -187,13 +182,8 @@ private static ConstructorInfo GetLongestConstructor(List<ConstructorInfo> const
187182
if (multipleBestLengthFound)
188183
{
189184
throw new RouteCreationException(
190-
#if !COMPONENTS
191185
Resources.FormatDefaultInlineConstraintResolver_AmbiguousCtors(
192186
parameterPolicyType.Name, longestLength));
193-
#else
194-
$"The constructor to use for activating the constraint type '{parameterPolicyType.Name}' " +
195-
$"is ambiguous. Multiple constructors were found with the following number of parameters: {longestLength}.");
196-
#endif
197187
}
198188

199189
return longest!;

0 commit comments

Comments
 (0)