Skip to content

Commit adf6515

Browse files
Fix IDE0057 warnings
Fix IDE0057 warnings identified in App-vNext#2003.
1 parent 9ccc6c6 commit adf6515

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/Polly.Core/Utils/TypeNameFormatter.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ public static string Format(Type type)
1717
return type.Name;
1818
}
1919

20-
return $"{type.Name.Substring(0, type.Name.Length - GenericSuffixLength)}<{Format(args[0])}>";
20+
#if NET6_0_OR_GREATER
21+
var nameNoAirity = type.Name[..(type.Name.Length - GenericSuffixLength)];
22+
#else
23+
var nameNoAirity = type.Name.Substring(0, type.Name.Length - GenericSuffixLength);
24+
#endif
25+
26+
return $"{nameNoAirity}<{Format(args[0])}>";
2127
}
2228
}

src/Polly/Utilities/KeyHelper.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,9 @@ internal static class KeyHelper
66
private const int GuidPartLength = 8;
77

88
public static string GuidPart() =>
9+
#if NET6_0_OR_GREATER
10+
Guid.NewGuid().ToString()[..GuidPartLength];
11+
#else
912
Guid.NewGuid().ToString().Substring(0, GuidPartLength);
13+
#endif
1014
}

0 commit comments

Comments
 (0)