Skip to content

Commit 35d9016

Browse files
Chris Martinezcommonsensesoftware
authored andcommitted
Fix code analysis violations
1 parent 3709354 commit 35d9016

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

src/Microsoft.AspNetCore.Mvc.Versioning/Routing/ApiVersionLinkGenerator.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class ApiVersionLinkGenerator : LinkGenerator
2424
protected LinkGenerator LinkGenerator { get; }
2525

2626
/// <inheritdoc />
27-
public override string GetPathByAddress<TAddress>(
27+
public override string? GetPathByAddress<TAddress>(
2828
HttpContext httpContext,
2929
TAddress address,
3030
RouteValueDictionary values,
@@ -38,15 +38,15 @@ public override string GetPathByAddress<TAddress>(
3838
}
3939

4040
/// <inheritdoc />
41-
public override string GetPathByAddress<TAddress>(
41+
public override string? GetPathByAddress<TAddress>(
4242
TAddress address,
4343
RouteValueDictionary values,
4444
PathString pathBase = default,
4545
FragmentString fragment = default,
4646
LinkOptions? options = null ) => LinkGenerator.GetPathByAddress( address, values, pathBase, fragment, options );
4747

4848
/// <inheritdoc />
49-
public override string GetUriByAddress<TAddress>(
49+
public override string? GetUriByAddress<TAddress>(
5050
HttpContext httpContext,
5151
TAddress address,
5252
RouteValueDictionary values,
@@ -62,7 +62,7 @@ public override string GetUriByAddress<TAddress>(
6262
}
6363

6464
/// <inheritdoc />
65-
public override string GetUriByAddress<TAddress>(
65+
public override string? GetUriByAddress<TAddress>(
6666
TAddress address,
6767
RouteValueDictionary values,
6868
string scheme,

src/Microsoft.AspNetCore.Mvc.Versioning/Versioning/Conventions/ControllerApiVersionConventionBuilder.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ protected override bool TryGetConvention( MethodInfo method, [NotNullWhen( true
2121
{
2222
if ( ActionBuilders.TryGetValue( method, out var actionBuilder ) )
2323
{
24-
convention = actionBuilder;
25-
return true;
24+
return ( convention = actionBuilder ) != null;
2625
}
2726

2827
convention = default;

src/Shared/TypeExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ static void ProcessGenericType( StringBuilder builder, Type type, Type[] generic
112112
}
113113
}
114114

115-
#if NETCOREAPP3_1
116-
var genericPartIndex = type.Name.IndexOf( '`', StringComparison.Ordinal );
117-
#else
115+
#if WEBAPI
118116
var genericPartIndex = type.Name.IndexOf( '`' );
117+
#else
118+
var genericPartIndex = type.Name.IndexOf( '`', StringComparison.Ordinal );
119119
#endif
120120

121121
if ( genericPartIndex <= 0 )

0 commit comments

Comments
 (0)