Please read the top-level CONTRIBUTING.md first for general contribution guidelines, pull request process, commit requirements, and DCO/sign-off requirements.
This document covers .NET-specific development setup and workflow.
- Git
- .NET SDK 8.0 or higher
- Rust toolchain (
cargo) - Install Rust - Bash shell (used by
build_native.sh)
-
Clone the repository:
git clone https://github.com/databricks/zerobus-sdk.git cd zerobus-sdk/dotnet -
Build the project:
make build
This will:
- Build the Rust FFI layer (
zerobus_ffi) - Build the .NET SDK
- Place the native library in
src/Zerobus/runtimes/<RID>/native/
- Build the Rust FFI layer (
-
Run tests:
make test
Code style is enforced by formatters in pull requests. We use dotnet format and rustfmt.
Format your code before committing:
make fmtThis runs:
dotnet formatfor .NET codecargo fmt --allfor Rust FFI code
Check your code for issues:
make lintThis runs:
- Rust linting via
cargo clippy --all -- -D warnings - .NET lint target currently prints a message and does not run standalone analyzers
Run the full test suite:
make testThis runs:
- Rust FFI tests via
cargo test - .NET tests via
dotnet test -p:SkipNativeBuild=true
-
Unit tests:
dotnet test tests/Zerobus.Tests -
Integration tests:
dotnet test tests/Zerobus.IntegrationTests
Integration tests use a mock gRPC server and exercise the SDK through the native FFI layer.
The .NET SDK relies on the Rust FFI library in ../rust/ffi.
When making FFI-related changes:
- Update Rust code in
../rust/ffi/src/ - Update exported C API in
../rust/ffi/zerobus.hif needed - Update .NET interop bindings in
src/Zerobus/Interop/ - Rebuild native artifacts:
./build_native.sh
- Run tests:
make test
dotnet buildautomatically invokesbuild_native.shfrom MSBuild.- To skip automatic native build (for example, when a prebuilt library is already present):
dotnet build -p:SkipNativeBuild=true
- To force a native rebuild:
./build_native.sh --force
All pull requests must pass CI checks.
Typical checks include:
- formatting:
dotnet formatandcargo fmt - lint: Rust lint (
cargo clippy) - test: .NET and Rust test suites
You can view CI results in the GitHub Actions tab of your pull request.
Available make targets:
make build- Build both Rust FFI and .NET SDKmake build-rust- Build only the Rust FFI layermake build-rust-force- Force rebuild Rust FFI artifactsmake build-dotnet- Build only the .NET SDKmake clean- Remove build artifactsmake fmt- Format all code (Rust and .NET)make fmt-dotnet- Format .NET codemake fmt-rust- Format Rust codemake lint- Run linters on all codemake lint-dotnet- Run .NET lint target (informational currently)make lint-rust- Run Rust clippymake check- Run formatting and lint checksmake test- Run all testsmake test-rust- Run Rust testsmake test-dotnet- Run .NET testsmake examples- Build all .NET examplesmake help- Show available targets