Skip to content

Exclude MemoryStream operations from VSTHRD103 - #1702

Draft
Andrew Arnott (AArnott) with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-vsthrd103-memorystream-operations
Draft

Andrew Arnott (AArnott) with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-vsthrd103-memorystream-operations

Conversation

Copilot AI commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

VSTHRD103 recommends async alternatives for synchronous MemoryStream operations, where accessing in-memory data needs no async machinery. These APIs should be exempt by default rather than requiring per-project configuration.

  • Packaged defaults: Exclude Read, Write, Flush, CopyTo, and Dispose.
  • Receiver matching: Match instance-method exclusions against the receiver’s static type as well as the declaring type, covering inherited overloads without suppressing diagnostics on Stream-typed receivers.
  • Coverage and documentation: Add regression coverage for overloads, conditional access, and Stream-typed calls. Document the defaults and note that CopyTo destinations may still perform blocking I/O.
static async Task<int> ReadAsync(MemoryStream stream, byte[] buffer)
{
    await Task.Yield();
    return stream.Read(buffer, 0, buffer.Length); // No VSTHRD103
}

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI and others added 2 commits October 13, 2026 16:50
Co-authored-by: AArnott <3548+AArnott@users.noreply.github.com>
Co-authored-by: AArnott <3548+AArnott@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix VSTHRD103 reporting on MemoryStream operations Exclude MemoryStream operations from VSTHRD103 Oct 13, 2026

This branch has not been deployed

No deployments
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.

VSTHRD103 should not report on MemoryStream operations

2 participants