Skip to content

Broaden MA0042/MA0045 SQLite special-case exclusions#1130

Merged
meziantou merged 1 commit intomainfrom
meziantou/expand-sqlite-exclusions
May 6, 2026
Merged

Broaden MA0042/MA0045 SQLite special-case exclusions#1130
meziantou merged 1 commit intomainfrom
meziantou/expand-sqlite-exclusions

Conversation

@meziantou
Copy link
Copy Markdown
Owner

Why

The recent SQLite handling for MA0042/MA0045 only excluded a small set of specific methods, which still left other synchronous SQLite calls flagged even though Microsoft.Data.Sqlite async APIs are documented with limitations.

What changed

  • Switched SQLite special-case detection from method-name checks to type-based checks.
  • Excluded invocations on SqliteConnection, SqliteCommand, and SqliteDataReader when SQLite special-cases are enabled.
  • Kept extension methods out of the SQLite special-case path so only methods on those SQLite types are excluded.
  • Applied the same SQLite special-case behavior to the using/await using analysis path.
  • Updated MA0042 and MA0045 rule docs to describe type-based SQLite exclusions.
  • Expanded tests (async and non-async contexts) to cover broader type behavior and added SqliteDataReader coverage, with option-enabled and option-disabled cases.

Notes for reviewers

The config switch (MA0042.enable_sqlite_special_cases, shared with MA0045) is unchanged. This PR only broadens what is considered a SQLite special-case when that option is enabled.

Treat all method calls on SqliteConnection, SqliteCommand, and SqliteDataReader as SQLite special cases for MA0042/MA0045 by default. Update tests and rule docs to reflect the broader type-based behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@meziantou meziantou merged commit 9f5bd3c into main May 6, 2026
13 checks passed
@meziantou meziantou deleted the meziantou/expand-sqlite-exclusions branch May 6, 2026 01:04
This was referenced May 6, 2026
This was referenced May 7, 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.

1 participant