Skip to main content

maid-validator-csharp

CI PyPI Python

A C# (.cs) language validator plugin for MAID Runner, backed by tree-sitter-c-sharp.

It registers through MAID Runner's maid_runner.validators entry point, so once installed alongside maid-runner, maid validate / maid snapshot / maid bootstrap handle .cs files with no core changes. This follows MAID Runner's validator plugin authoring support boundary: new languages ship as external packages.

Install

pip install maid-validator-csharp
# or, for local development against a checked-out maid-runner:
uv pip install -e ../maid-runner -e .

Confirm it is active:

maid validators
# CSharpValidator   .cs   maid-validator-csharp <ver>   active

What it collects

C# constructs are mapped onto MAID's language-neutral artifact kinds:

C# construct MAID kind Notes
namespace (block and file-scoped) namespace
class, struct, record, record struct class bases = base type + implemented interfaces
interface interface members are implicitly public
enum enum
delegate type records args + return type
method / constructor method of = declaring type; captures args (name/type/default), returns, generic type_parameters, async
property / field attribute of = declaring type; captures the declared type
top-level local function function

Only the public API surface is emitted — public/protected members and public types, interface members, and top-level local functions. private/internal/implicitly-private members are dropped, and leading-underscore names are treated as private (excluded from snapshots).

Behavioral collection (from test files) emits test_function markers for xUnit/NUnit/MSTest methods ([Fact], [Theory], [Test], [TestMethod], …) and identity references for the types (new Widget()) and methods (Calc.Add(...), Render(...)) those tests exercise.

Development

uv sync            # installs the locked published dependency graph
uv run pytest -v   # runs the MAID conformance kit + hand-written suites
uv run ruff check src/ tests/
uv run black --check src/ tests/

Version 0.2.0 requires MAID Runner 2.24 or newer. That release provides the language-aware type-comparison and exact callable-signature contracts used by the plugin. Package and CI resolution use published dependencies; local editable Runner checkouts are optional development tooling only.

C# type comparison

Manifest comparison accepts equivalent C# source spellings without changing the raw types emitted by collection or snapshots. Supported equivalences are:

  • every built-in C# keyword/CLR type pair, including native integers and dynamic/System.Object;
  • global:: qualification and explicit List, Dictionary, Task, and Nullable BCL qualifications;
  • nested generics, nullable known value types, nullable annotations on known reference types, arrays and their ranks, and tuple element names.

Comparison remains conservative without compiler evidence. Arbitrary custom names do not collapse across namespaces, unknown T? or Widget? forms stay distinct from their unannotated form, and array suffix order, tuple position, and tuple arity remain significant. Pointer and function-pointer spellings use a deterministic lexical comparison when they fall outside the structured subset.

The MAID conformance kit (tests/test_conformance.py) is the acceptance bar: it proves the collector cannot manufacture false-green validation for C#.

Exact overload definitions

Methods, constructors, and top-level functions expose canonical definition signatures so manifests can select an exact overload. Identity includes method generic arity, canonical parameter types, C# by-reference semantics, explicit-interface qualification, and __arglist. Raw argument and return spellings remain source-shaped. Syntax-only behavioral calls intentionally stay unsigned because tree-sitter cannot bind a call to a compiler-selected overload; that semantic path remains reserved for optional Roslyn integration.

See CHANGELOG.md for release history and RELEASING.md for the trusted-publishing procedure.

Known limitations

  • Semantic type identity: syntax-level comparison cannot determine whether an arbitrary custom type is a value type, resolve aliases/usings, or prove compiler-bound identity. Those cases remain exact until the optional Roslyn semantic path is implemented.
  • Module identity: C# module identity is the in-file namespace, not a path-derived module, so cross-file using/namespace resolution is not yet performed; behavioral matching binds on kind/name/parent.
  • Partial classes are collected per file; cross-file merging is MAID Runner's responsibility via manifest chains.
  • Parser fidelity is bounded by the tree-sitter-c-sharp grammar. Unparseable or unsupported syntax yields a CollectionResult with errors and no artifacts (never a crash).

Metadata

Release files for maid-validator-csharp 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for maid-validator-csharp 0.2.0
File Size Uploaded Provenance
maid_validator_csharp-0.2.0.tar.gz 25.7 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for maid-validator-csharp 0.2.0
File Interpreter ABI Platform
maid_validator_csharp-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 41.7 kB

Release files / maid_validator_csharp-0.2.0.tar.gz

Download URL maid_validator_csharp-0.2.0.tar.gz
Size 25.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ec5b9cc8003713068215ef3b2ac601b250b4a8880f21710ea79e27cf3fe307aa
BLAKE2b-256 checksum
How to use checksums
f09f00b44b2256b7eb0a9053ccc1e90aee708854cabcf35143afb610b37d2fab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.

Transparency log

Release files / maid_validator_csharp-0.2.0-py3-none-any.whl

Download URL maid_validator_csharp-0.2.0-py3-none-any.whl
Size 16.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4f47c7652fb43626233444a7daa51da45a7187e5781a0e426ddcc429257cd09
BLAKE2b-256 checksum
How to use checksums
08ba6097e8a9ff4e9a66224a198c24fe299dfe83c1c9883a964c3be8d873f282
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.

Transparency log

Security for maid-validator-csharp 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for maid_validator_csharp-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page