Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port fixes from .NET 9 testing #2056

Merged
merged 7 commits into from
Apr 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix IDE0057 warnings
Fix IDE0057 warnings identified in #2003.
martincostello committed Apr 12, 2024
commit adf651544b64858974bde5fbac25c5911e126f0c
8 changes: 7 additions & 1 deletion src/Polly.Core/Utils/TypeNameFormatter.cs
Original file line number Diff line number Diff line change
@@ -17,6 +17,12 @@ public static string Format(Type type)
return type.Name;
}

return $"{type.Name.Substring(0, type.Name.Length - GenericSuffixLength)}<{Format(args[0])}>";
#if NET6_0_OR_GREATER
var nameNoAirity = type.Name[..(type.Name.Length - GenericSuffixLength)];
#else
var nameNoAirity = type.Name.Substring(0, type.Name.Length - GenericSuffixLength);
#endif

return $"{nameNoAirity}<{Format(args[0])}>";
}
}
4 changes: 4 additions & 0 deletions src/Polly/Utilities/KeyHelper.cs
Original file line number Diff line number Diff line change
@@ -6,5 +6,9 @@ internal static class KeyHelper
private const int GuidPartLength = 8;

public static string GuidPart() =>
#if NET6_0_OR_GREATER
Guid.NewGuid().ToString()[..GuidPartLength];
#else
Guid.NewGuid().ToString().Substring(0, GuidPartLength);
#endif
}