Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 10, 2025

Fixes #

main PR

Description

Roslyn 4.14.0 introduced stricter type checking for MemoryMarshal methods called on arrays, now returning ReadOnlySpan<T> instead of Span<T>. This breaks code requiring writable spans.

Fixed two compilation errors:

  • System.Text.Json/JsonDocument.MetadataDb.cs: MemoryMarshal.Cast<byte, int>(newDatabase)MemoryMarshal.Cast<byte, int>(newDatabase.AsSpan())
  • System.Runtime.Numerics/BigInteger.cs: MemoryMarshal.AsBytes<uint>(val)MemoryMarshal.AsBytes(val.AsSpan())

Both changes explicitly convert arrays to Span<T> before calling MemoryMarshal methods to preserve write access.

Customer Impact

Build failures on Roslyn 4.14.0+ due to implicit conversion errors from ReadOnlySpan<T> to Span<T>.

Regression

Yes. Introduced by the Roslyn dependency update in this release.

Testing

Verified fix compiles and matches existing patterns in codebase (e.g., BigInteger.cs line 375, 1085).

Risk

Low. Minimal changes to preserve existing writable span semantics. Pattern already used elsewhere in affected files.

Package authoring no longer needed in .NET 9

IMPORTANT: Starting with .NET 9, you no longer need to edit a NuGet package's csproj to enable building and bump the version.
Keep in mind that we still need package authoring in .NET 8 and older versions.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: steveisok <471438+steveisok@users.noreply.github.com>
Copilot AI changed the title [WIP] Update dependencies from dotnet/roslyn Fix MemoryMarshal implicit conversion errors after Roslyn 4.14.0 update Nov 10, 2025
Copilot AI requested a review from steveisok November 10, 2025 16:52
@steveisok
Copy link
Member

No longer needed - pushed change in PR branch

@steveisok steveisok closed this Nov 10, 2025
@jkotas jkotas deleted the copilot/sub-pr-121343-again branch November 12, 2025 05:16
@github-actions github-actions bot locked and limited conversation to collaborators Dec 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants