Skip to content

Fix netstandard2.0/net48 build in writable archive key normalisation - #1490

Merged
adamhathcock merged 1 commit into
releasefrom
fix/legacy-startswith-char
Nov 9, 2026
Merged

adamhathcock merged 1 commit into
releasefrom
fix/legacy-startswith-char

Conversation

@adamhathcock

@adamhathcock adamhathcock commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Why

AbstractWritableArchive.NormalizeKey (added in 990186a) calls string.StartsWith(char), which does not exist on netstandard2.0 or net48. The release branch currently fails to build for those targets.

Change

Replace key.StartsWith('/') with key.Length > 0 && key[0] == '/'. Behaviour is unchanged.

Checks run

  • dotnet build -c Release: all targets succeed, 0 warnings
  • dotnet test -c Release: net10.0 2494 passed, net48 2385 passed, 0 failed
  • dotnet csharpier check .: clean

string.StartsWith(char) is not available on netstandard2.0 or net48,
so those targets failed to compile after 990186a.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 9, 2026 11:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are recorded for the framework-compatibility change in key normalization.

No open issues 🎉

What changed in this PR

Restores .NET Standard 2.0 and .NET Framework 4.8 build compatibility in writable archive key normalization without changing behavior.

Changes:

  • Replaces the unsupported string.StartsWith(char) call with a length check and character comparison.
  • Preserves empty-string handling and removal of a single leading slash.
File Description
src/​SharpCompress/​Archives/​AbstractWritableArchive.cs Uses a framework-compatible leading-slash check in NormalizeKey.

Review effort: Balanced

@adamhathcock
adamhathcock merged commit 839dcb1 into release Nov 9, 2026
4 checks passed
@adamhathcock
adamhathcock deleted the fix/legacy-startswith-char branch November 9, 2026 11:26
This was referenced Nov 12, 2026
This was referenced Nov 23, 2026
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.

2 participants