Skip to content

Conversation

pmaytak
Copy link
Contributor

@pmaytak pmaytak commented May 29, 2025

Fixes #3251

  • Adds an overload for internal static int Decode(ReadOnlySpan<char> strSpan, Span<byte> output) with int return type for NET 6 and NET 8.
  • Adds API tests.
Version TFM Method return value Uses new Base64 API
<= 8.3.0 All void No
8.3.1 - 8.9.0 All int Yes
8.10.0 - 8.11.0 NET9 int Yes
ELSE void No
>= 8.12.0 NET9 int Yes
NET6, 8 int No
ELSE void No

Working notes which can be disregarded (just didn't want to lose them):

<= 8.3.0
internal static void Decode(ReadOnlySpan strSpan, Span output)

NET6+
private static int Decode(ReadOnlySpan strSpan, Span output, bool needReplace, int decodedLength)
ELSE
private static void Decode(ReadOnlySpan strSpan, Span output, bool needReplace, int decodedLength)

8.3.1 - 8.9.0
internal static int Decode(ReadOnlySpan strSpan, Span output)

NETCOREAPP
private static int Decode(ReadOnlySpan strSpan, Span output, int decodedLength)
ELSE
private static int Decode(ReadOnlySpan strSpan, Span output, int decodedLength)

8.10.0 - 8.11.0
NET9
int Decode(ReadOnlySpan strSpan, Span output)
ELSE
void Decode(ReadOnlySpan strSpan, Span output)

NET9
private static int Decode(ReadOnlySpan strSpan, Span output, int decodedLength)
NET6, NET8
private static int Decode(ReadOnlySpan strSpan, Span output, bool needReplace, int decodedLength)
ELSE
private static void Decode(ReadOnlySpan strSpan, Span output, bool needReplace, int decodedLength)

Copy link

Summary

Summary
Generated on: 5/30/2025 - 8:24:39 AM
Coverage date: 5/30/2025 - 8:14:28 AM - 5/30/2025 - 8:24:10 AM
Parser: MultiReport (60x Cobertura)
Assemblies: 1
Classes: 7
Files: 2
Line coverage: 80.3% (620 of 772)
Covered lines: 620
Uncovered lines: 152
Coverable lines: 772
Total lines: 483
Branch coverage: 67.8% (228 of 336)
Covered branches: 228
Total branches: 336
Method coverage: Feature is only available for sponsors

Coverage

Microsoft.IdentityModel.JsonWebTokens - 80.3%
Name Line Branch
Microsoft.IdentityModel.JsonWebTokens 80.3% 67.8%
Microsoft.IdentityModel.JsonWebTokens.JwtTokenUtilities 100%
System.Text.RegularExpressions.Generated 80.3% 67.8%
System.Text.RegularExpressions.Generated 80.3% 67.8%
System.Text.RegularExpressions.Generated.<RegexGenerator_g>F12A1AEDDDFE32BA
DF4DBFF323AF1BCB48B9F9721B7CD3E05F5E034CF225E3DF8__CreateJweRegex_1
79.2% 68%
System.Text.RegularExpressions.Generated.<RegexGenerator_g>F12A1AEDDDFE32BA
DF4DBFF323AF1BCB48B9F9721B7CD3E05F5E034CF225E3DF8__CreateJwsRegex_0
81.4% 67.6%
System.Text.RegularExpressions.Generated.<RegexGenerator_g>F334844C618E00D3
CEC5D3FE0D00CF0141BBEE98635313BB2CB8D3921464CE05A__CreateJweRegex_1
79.2% 68%
System.Text.RegularExpressions.Generated.<RegexGenerator_g>F334844C618E00D3
CEC5D3FE0D00CF0141BBEE98635313BB2CB8D3921464CE05A__CreateJwsRegex_0
81.4% 67.6%

@pmaytak pmaytak marked this pull request as ready for review May 30, 2025 08:34
@pmaytak pmaytak requested a review from a team as a code owner May 30, 2025 08:34
@pmaytak pmaytak changed the title Add API tests. Add expected Base64UrlEncoder.Decode overload for NET6 and 8 May 30, 2025
Copy link
Contributor

@mdchennu mdchennu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm really sorry about missing the different in returns for the Decode method, Peter. Thank you for noticing and fixing it. The change makes sense to me! I noticed a unit test (unrelated) was failing, so re-ran the job.

Copy link

Summary

Summary
Generated on: 5/30/2025 - 4:23:37 PM
Coverage date: 5/30/2025 - 4:13:21 PM - 5/30/2025 - 4:23:00 PM
Parser: MultiReport (60x Cobertura)
Assemblies: 1
Classes: 7
Files: 2
Line coverage: 80.3% (620 of 772)
Covered lines: 620
Uncovered lines: 152
Coverable lines: 772
Total lines: 483
Branch coverage: 67.8% (228 of 336)
Covered branches: 228
Total branches: 336
Method coverage: Feature is only available for sponsors

Coverage

Microsoft.IdentityModel.JsonWebTokens - 80.3%
Name Line Branch
Microsoft.IdentityModel.JsonWebTokens 80.3% 67.8%
Microsoft.IdentityModel.JsonWebTokens.JwtTokenUtilities 100%
System.Text.RegularExpressions.Generated 80.3% 67.8%
System.Text.RegularExpressions.Generated 80.3% 67.8%
System.Text.RegularExpressions.Generated.<RegexGenerator_g>F12A1AEDDDFE32BA
DF4DBFF323AF1BCB48B9F9721B7CD3E05F5E034CF225E3DF8__CreateJweRegex_1
79.2% 68%
System.Text.RegularExpressions.Generated.<RegexGenerator_g>F12A1AEDDDFE32BA
DF4DBFF323AF1BCB48B9F9721B7CD3E05F5E034CF225E3DF8__CreateJwsRegex_0
81.4% 67.6%
System.Text.RegularExpressions.Generated.<RegexGenerator_g>F334844C618E00D3
CEC5D3FE0D00CF0141BBEE98635313BB2CB8D3921464CE05A__CreateJweRegex_1
79.2% 68%
System.Text.RegularExpressions.Generated.<RegexGenerator_g>F334844C618E00D3
CEC5D3FE0D00CF0141BBEE98635313BB2CB8D3921464CE05A__CreateJwsRegex_0
81.4% 67.6%

return Decode(strSpan, output, decodedLength);
}
#elif NET6_0_OR_GREATER
internal static int Decode(ReadOnlySpan<char> strSpan, Span<byte> output)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would think we need to adjust the API files for this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be a follow up

Copy link

Summary

Summary
Generated on: 5/30/2025 - 8:34:41 PM
Coverage date: 5/30/2025 - 8:23:47 PM - 5/30/2025 - 8:34:11 PM
Parser: MultiReport (60x Cobertura)
Assemblies: 1
Classes: 7
Files: 2
Line coverage: 80.3% (620 of 772)
Covered lines: 620
Uncovered lines: 152
Coverable lines: 772
Total lines: 483
Branch coverage: 67.8% (228 of 336)
Covered branches: 228
Total branches: 336
Method coverage: Feature is only available for sponsors

Coverage

Microsoft.IdentityModel.JsonWebTokens - 80.3%
Name Line Branch
Microsoft.IdentityModel.JsonWebTokens 80.3% 67.8%
Microsoft.IdentityModel.JsonWebTokens.JwtTokenUtilities 100%
System.Text.RegularExpressions.Generated 80.3% 67.8%
System.Text.RegularExpressions.Generated 80.3% 67.8%
System.Text.RegularExpressions.Generated.<RegexGenerator_g>F12A1AEDDDFE32BA
DF4DBFF323AF1BCB48B9F9721B7CD3E05F5E034CF225E3DF8__CreateJweRegex_1
79.2% 68%
System.Text.RegularExpressions.Generated.<RegexGenerator_g>F12A1AEDDDFE32BA
DF4DBFF323AF1BCB48B9F9721B7CD3E05F5E034CF225E3DF8__CreateJwsRegex_0
81.4% 67.6%
System.Text.RegularExpressions.Generated.<RegexGenerator_g>F334844C618E00D3
CEC5D3FE0D00CF0141BBEE98635313BB2CB8D3921464CE05A__CreateJweRegex_1
79.2% 68%
System.Text.RegularExpressions.Generated.<RegexGenerator_g>F334844C618E00D3
CEC5D3FE0D00CF0141BBEE98635313BB2CB8D3921464CE05A__CreateJwsRegex_0
81.4% 67.6%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] MissingMethodException for Base64UrlEncoder.Decode

4 participants