Instructions for AI coding agents working on the .NEXT repository.
Read CONTRIBUTING.md before making changes or opening a PR. It defines the rules for branches, labels, unit tests and backward compatibility. In particular, all PRs must target the develop branch.
- Solution File - the solution. Libraries:
DotNext,DotNext.IO,DotNext.Threading,DotNext.Unsafe,DotNext.Metaprogramming,DotNext.MaintenanceServices,cluster/DotNext.Net.Cluster,cluster/DotNext.AspNetCore.Cluster. - Tests:
- Unit Tests - unit tests for all libraries
- AOT Tests - tests running under Native AOT.
- Benchmarks - benchmarks.
- Examples - examples.
- AI Skills - Agent Skills for users of the libraries. Update them if you change the public API they describe.
- Changelog - release notes, grouped by NuGet package.
- Documentation lives in the separate
gh-pagesbranch (docs/folder, docfx). It is not part ofdevelop.
- .NET SDK version is pinned in global.json. All projects target
net10.0with the latest C# version and nullable reference types enabled. - Build:
dotnet build src/DotNext.slnx - Libraries are marked
IsAotCompatible. New code must not introduce trimming or AOT warnings (IL2xxx/IL3xxx). Don't suppress them without a justification. - Public members require XML documentation comments (documentation file generation is enabled).
- Code style is defined by editorconfig file. Follow the style of the surrounding code.
- Avoid third-party dependencies. Don't add package references without discussion in the PR. Package versions are managed centrally in Directory.Packages.props, don't specify versions in
.csprojfiles. - Avoid Reflection in new code, especially on hot paths. Where it's unavoidable, it must be trimming/AOT-safe (see Build).
- Prefer
Span<T>andReadOnlySpan<T>over arrays in synchronous code. - Prefer
Memory<T>andReadOnlyMemory<T>over arrays in asynchronous code. - Prefer
ValueTaskandValueTask<T>overTaskandTask<T>in asynchronous method implementations. - The preferences above apply to new APIs and internal code. Don't change existing public signatures: it's a breaking change.
- Keep comments short and clear. Large comments are needed only when complex or concurrent behavior requires explanation.
Tests use xunit.v3 on Microsoft.Testing.Platform. The project must be passed via --project, and VSTest --filter expressions don't work.
- All tests:
dotnet test --project src/DotNext.Tests/DotNext.Tests.csproj - Single test or class:
dotnet test --project src/DotNext.Tests/DotNext.Tests.csproj --filter-method "*.TestName" dotnet test --project src/DotNext.Tests/DotNext.Tests.csproj --filter-class "*.ClassName" - AOT tests (linux-x64):
dotnet publish src/DotNext.Aot.Tests/DotNext.Aot.Tests.csproj -c Release -o src/DotNext.Aot.Tests/bin/aot -p:PublishAot=true src/DotNext.Aot.Tests/bin/aot/DotNext.Aot.Tests - Concurrency tests can be flaky under load. If a test hangs rarely, don't just rerun it until it passes: report it.
[UnsafeAccessor]methods declared as local functions inside a generic method fail to bind at runtime (MissingMethodException) even if the target member exists. Declare them as class-levelstatic externmethods.- Parameters widened with
[UnsafeAccessorType]are type-checked at runtime: a wrong argument type throwsInvalidCastException.