Skip to content

005 dotnet bindings#7

Merged
MathiasVDA merged 21 commits into
mainfrom
005-dotnet-bindings
May 13, 2026
Merged

005 dotnet bindings#7
MathiasVDA merged 21 commits into
mainfrom
005-dotnet-bindings

Conversation

@MathiasVDA
Copy link
Copy Markdown
Contributor

No description provided.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

❌ Patch coverage is 91.80328% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
tp-core/src/io/csv.rs 82.75% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new tp-net Rust crate and accompanying TpLib C# library to expose tp-lib-core functionality to .NET consumers via a JSON-over-FFI ByteBuffer contract, plus CI/NuGet packaging scaffolding and core in-memory parsing helpers required for FFI use cases.

Changes:

  • Introduces Rust FFI surface (tp-net) for GNSS projection, path calculation, and detection preparation using heap-owned ByteBuffer payloads.
  • Adds managed C# API (TpLib) with models, native resolver, P/Invoke stubs, and xUnit tests.
  • Extends tp-core parsers with *_str in-memory variants to avoid disk I/O and support FFI.

Reviewed changes

Copilot reviewed 80 out of 191 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
tp-net/src/marshal.rs Rust JSON (de)serialization helpers for FFI payloads
tp-net/src/lib.rs Rust extern "C" FFI entry points for projection/path/detection flows
tp-net/src/ffi.rs Rust ByteBuffer + #[repr(C)] config structs and free function
tp-net/README.md README for the .NET bindings package
tp-net/csharp/TpLibNative.cs Native library resolver + free-buffer helper
tp-net/csharp/TpLib.targets MSBuild target for copying RID-specific native binaries
tp-net/csharp/TpLib.csproj .NET project + packaging configuration for NuGet
tp-net/csharp/TpLib.cs Public managed API wrappers around the FFI calls
tp-net/csharp/Tests/TpLib.Tests.csproj xUnit test project
tp-net/csharp/Tests/TestData.cs Test helper for locating fixture data
tp-net/csharp/Tests/SerializationTests.cs JSON serialization unit tests for enums/config/timestamps
tp-net/csharp/Tests/ProjectionTests.cs Projection integration tests using sample fixtures
tp-net/csharp/Tests/PathCalculationTests.cs Path calculation integration tests
tp-net/csharp/Tests/InMemoryInputTests.cs Tests for in-memory network/GNSS input builders
tp-net/csharp/Tests/DetectionPreparationTests.cs Detection preparation integration tests
tp-net/csharp/Tests/obj/TpLib.Tests.csproj.nuget.g.targets Generated build output committed in-tree
tp-net/csharp/Tests/obj/TpLib.Tests.csproj.nuget.g.props Generated build output committed in-tree
tp-net/csharp/Tests/obj/TpLib.Tests.csproj.nuget.dgspec.json Generated build output committed in-tree
tp-net/csharp/Tests/obj/project.nuget.cache Generated build output committed in-tree
tp-net/csharp/Tests/obj/Debug/net8.0/TpLib.Tests.sourcelink.json Generated build output committed in-tree
tp-net/csharp/Tests/obj/Debug/net8.0/TpLib.Tests.GlobalUsings.g.cs Generated build output committed in-tree
tp-net/csharp/Tests/obj/Debug/net8.0/TpLib.Tests.genruntimeconfig.cache Generated build output committed in-tree
tp-net/csharp/Tests/obj/Debug/net8.0/TpLib.Tests.GeneratedMSBuildEditorConfig.editorconfig Generated build output committed in-tree
tp-net/csharp/Tests/obj/Debug/net8.0/TpLib.Tests.csproj.FileListAbsolute.txt Generated build output committed in-tree
tp-net/csharp/Tests/obj/Debug/net8.0/TpLib.Tests.csproj.CoreCompileInputs.cache Generated build output committed in-tree
tp-net/csharp/Tests/obj/Debug/net8.0/TpLib.Tests.AssemblyInfoInputs.cache Generated build output committed in-tree
tp-net/csharp/Tests/obj/Debug/net8.0/TpLib.Tests.AssemblyInfo.cs Generated build output committed in-tree
tp-net/csharp/Tests/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs Generated build output committed in-tree
tp-net/csharp/Tests/bin/Debug/net8.0/TpLib.xml Generated build output committed in-tree
tp-net/csharp/Tests/bin/Debug/net8.0/TpLib.Tests.runtimeconfig.json Generated build output committed in-tree
tp-net/csharp/Tests/bin/Debug/net8.0/TpLib.Tests.deps.json Generated build output committed in-tree
tp-net/csharp/obj/TpLib.csproj.nuget.g.targets Generated build output committed in-tree
tp-net/csharp/obj/TpLib.csproj.nuget.g.props Generated build output committed in-tree
tp-net/csharp/obj/TpLib.csproj.nuget.dgspec.json Generated build output committed in-tree
tp-net/csharp/obj/Release/net8.0/TpLib.xml Generated build output committed in-tree
tp-net/csharp/obj/Release/net8.0/TpLib.sourcelink.json Generated build output committed in-tree
tp-net/csharp/obj/Release/net8.0/TpLib.GlobalUsings.g.cs Generated build output committed in-tree
tp-net/csharp/obj/Release/net8.0/TpLib.GeneratedMSBuildEditorConfig.editorconfig Generated build output committed in-tree
tp-net/csharp/obj/Release/net8.0/TpLib.csproj.FileListAbsolute.txt Generated build output committed in-tree
tp-net/csharp/obj/Release/net8.0/TpLib.csproj.CoreCompileInputs.cache Generated build output committed in-tree
tp-net/csharp/obj/Release/net8.0/TpLib.AssemblyInfoInputs.cache Generated build output committed in-tree
tp-net/csharp/obj/Release/net8.0/TpLib.AssemblyInfo.cs Generated build output committed in-tree
tp-net/csharp/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs Generated build output committed in-tree
tp-net/csharp/obj/project.nuget.cache Generated build output committed in-tree
tp-net/csharp/obj/project.assets.json Generated build output committed in-tree
tp-net/csharp/obj/Debug/net8.0/TpLib.xml Generated build output committed in-tree
tp-net/csharp/obj/Debug/net8.0/TpLib.sourcelink.json Generated build output committed in-tree
tp-net/csharp/obj/Debug/net8.0/TpLib.GlobalUsings.g.cs Generated build output committed in-tree
tp-net/csharp/obj/Debug/net8.0/TpLib.GeneratedMSBuildEditorConfig.editorconfig Generated build output committed in-tree
tp-net/csharp/obj/Debug/net8.0/TpLib.csproj.FileListAbsolute.txt Generated build output committed in-tree
tp-net/csharp/obj/Debug/net8.0/TpLib.csproj.CoreCompileInputs.cache Generated build output committed in-tree
tp-net/csharp/obj/Debug/net8.0/TpLib.AssemblyInfoInputs.cache Generated build output committed in-tree
tp-net/csharp/obj/Debug/net8.0/TpLib.AssemblyInfo.cs Generated build output committed in-tree
tp-net/csharp/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs Generated build output committed in-tree
tp-net/csharp/NuGet.config NuGet feed configuration for the C# projects
tp-net/csharp/NativeMethods.g.cs csbindgen-generated P/Invoke stubs and FFI structs
tp-net/csharp/Models.cs Managed DTOs + NetworkInput/GnssInput builders + JSON options
tp-net/csharp/Exceptions.cs Managed exception hierarchy
tp-net/csharp/Enums.cs Managed enums mirrored from Rust concepts
tp-net/csharp/bin/Release/net8.0/TpLib.xml Generated build output committed in-tree
tp-net/csharp/bin/Release/net8.0/TpLib.deps.json Generated build output committed in-tree
tp-net/csharp/bin/Debug/net8.0/TpLib.xml Generated build output committed in-tree
tp-net/csharp/bin/Debug/net8.0/TpLib.deps.json Generated build output committed in-tree
tp-net/Cargo.toml New Rust crate manifest for .NET bindings
tp-net/build.rs build-script for csbindgen C# stub generation
tp-lib.sln Visual Studio solution file including TpLib + tests
tp-core/src/lib.rs Re-exports for new in-memory parser helpers
tp-core/src/io/geojson/detections.rs Adds load_str for in-memory detection GeoJSON parsing
tp-core/src/io/geojson.rs Adds parse_network_geojson_str and parse_gnss_geojson_str
tp-core/src/io/csv/detections.rs Adds load_str for in-memory detection CSV parsing
tp-core/src/io/csv.rs Adds parse_gnss_csv_str and shared DF parsing helper
tp-core/src/io.rs Re-exports new in-memory parsing helpers
specs/005-dotnet-bindings/tasks.md Feature task breakdown for tp-net
specs/005-dotnet-bindings/spec.md Feature specification for tp-net
specs/005-dotnet-bindings/research.md Research/decisions for FFI + packaging approach
specs/005-dotnet-bindings/quickstart.md End-to-end quickstart documentation for .NET consumers
specs/005-dotnet-bindings/plan.md Implementation plan for the feature
specs/005-dotnet-bindings/data-model.md Data model and FFI mapping documentation
specs/005-dotnet-bindings/checklists/requirements.md Spec quality checklist
README.md Root README updated with NuGet badge + tp-net mention
docs/OpenRail-onboarding.md Onboarding doc updated with .NET bindings mention
Cargo.toml Adds tp-net to the Rust workspace members
.github/workflows/publish-nuget.yml New workflow to build native libs and publish NuGet package
.github/workflows/ci.yml Adds .NET test job to CI
.github/agents/copilot-instructions.md Updates dev guidelines to include tp-net tech stack
Comments suppressed due to low confidence (1)

tp-net/csharp/TpLib.cs:116

  • CalculateTrainPath rejects CSV-backed GnssInput, which makes GnssInput.FromCsv unusable for this entry point as well. Consider supporting CSV here too (using tp_lib_core::parse_gnss_csv_str) or removing the CSV constructor to keep the surface coherent.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tp-net/csharp/Models.cs Outdated
Comment thread tp-net/csharp/TpLib.cs
Comment thread specs/005-dotnet-bindings/quickstart.md
Comment thread tp-net/src/lib.rs
Comment thread tp-net/src/lib.rs
Comment thread tp-net/src/ffi.rs
Comment thread tp-net/src/ffi.rs
Comment thread tp-net/csharp/Tests/obj/TpLib.Tests.csproj.nuget.g.props Outdated
Comment thread .github/workflows/publish-nuget.yml Outdated
Comment thread tp-net/build.rs Outdated
@MathiasVDA
Copy link
Copy Markdown
Contributor Author

@copilot apply changes based on the comments in this thread

Copilot AI and others added 2 commits May 13, 2026 15:26
Copy link
Copy Markdown
Contributor

Copilot AI commented May 13, 2026

@copilot apply changes based on the comments in this thread

Applied requested changes from the review thread for CSV GNSS support end-to-end in the .NET bindings/FFI path, with tests updated. Addressed in b54bcdd and refined in 231023c.

@MathiasVDA MathiasVDA merged commit 268d9dc into main May 13, 2026
8 checks passed
@MathiasVDA MathiasVDA deleted the 005-dotnet-bindings branch May 13, 2026 18:37
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.

3 participants