Skip to content

Document threading test purpose and intentional non-disposal - #4106

Closed
mattleibow wants to merge 1 commit into
mainfrom
mattleibow/threading-test-purpose-comments
Closed

mattleibow wants to merge 1 commit into
mainfrom
mattleibow/threading-test-purpose-comments

Conversation

@mattleibow

Copy link
Copy Markdown
Contributor

Summary

The x86 .NET Framework OOM fix for the GC/finalizer threading stress tests already landed on main in #3674. However, the tests don't explain why they are written the way they are, which has led to well-intentioned-but-wrong attempts to "fix" them by adding disposal.

This is a comment-only change (no behavioral change) that documents the intent:

  • SKBitmapThreadingTest.ImageScalingMultipleThreadsTest intentionally creates native SkiaSharp objects (SKBitmap/SKImage/SKData) and does NOT dispose them, so they are reclaimed only by the GC and finalizer thread. That is the whole point — it verifies SkiaSharp objects can be finalized safely from many threads concurrently. A Do NOT add using/Dispose warning is added so future readers don't short-circuit finalization and defeat the test.
  • SKObjectTest.EnsureMultithreadingDoesNotThrow gets a purpose comment describing the concurrent-decode stress and the existing x86 address-space skip.

Context

The companion fix for release/3.119.x (which did not yet have #3674) is #4105. This PR ensures both main and the release branch carry the same explanatory comments.

Co-authored-by: Copilot [email protected]

The x86 OOM fix for these GC/finalizer stress tests already landed in #3674.
This adds comments documenting WHY the tests are written the way they are so
future readers don't "fix" them incorrectly:

- SKBitmapThreadingTest.ImageScalingMultipleThreadsTest intentionally leaves
  native objects undisposed so they are reclaimed only by the GC/finalizer.
  Adding using/Dispose would defeat the purpose of the test.
- SKObjectTest.EnsureMultithreadingDoesNotThrow documents the concurrent
  decode stress purpose and the x86 address-space skip.

No behavioral change.

Co-authored-by: Copilot <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

📦 Try the packages from this PR

Warning

Do not run these scripts without first reviewing the code in this PR.

Step 1 — Download the packages

bash / macOS / Linux:

curl -fsSL https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.sh | bash -s -- 4106

PowerShell / Windows:

iex "& { $(irm https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.ps1) } 4106"

Step 2 — Add the local NuGet source

dotnet nuget add source ~/.skiasharp/hives/pr-4106/packages --name skiasharp-pr-4106
More options
Option Description
--successful-only / -SuccessfulOnly Only use successful builds
--force / -Force Overwrite previously downloaded packages
--list / -List List available artifacts without downloading
--build-id ID / -BuildId ID Download from a specific build

Or download manually from Azure Pipelines — look for the nuget artifact on the build for this PR.

Remove the source when you're done:

dotnet nuget remove source skiasharp-pr-4106

@github-actions

Copy link
Copy Markdown
Contributor

📖 Documentation Preview

The documentation for this PR has been deployed and is available at:

🔗 View Staging Site
🔗 View Staging Docs
🔗 View Staging Gallery (Blazor)
🔗 View Staging Gallery (Uno Platform)
🔗 View Staging SkiaFiddle

This preview will be updated automatically when you push new commits to this PR.


This comment is automatically updated by the documentation staging workflow.

@mattleibow mattleibow closed this Jul 20, 2026
@mattleibow
mattleibow deleted the mattleibow/threading-test-purpose-comments branch July 20, 2026 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant