Repository navigation
bindings: make C# types public - #211
Open
lisboaigor wants to merge 1 commit into
Open
lisboaigor wants to merge 1 commit into
lisboaigor wants to merge 1 commit into
Conversation
uniffi-bindgen-cs emits `internal` types unless `access_modifier` is set, and uniffi.toml had no csharp section. As a result the LiquidWalletKit package exposed no public API: using any type, such as `Network.Mainnet()`, from outside the assembly fails with CS0122. The C# test was not affected because it is compiled together with lwk.cs in the same assembly. Set `access_modifier = "public"`. FFI helper types stay internal, as the generator hard-codes them. Checked by generating the bindings with the pinned uniffi-bindgen-cs and building a separate consumer project: it failed with CS0122 before this change and builds and runs after it.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #210
Change
Add a
[bindings.csharp]section withaccess_modifier = "public"tolwk_bindings/uniffi.toml.uniffi-bindgen-csdefaults tointernalfor the exported types (seedocs/CONFIGURATION.mdin that project), so the publishedLiquidWalletKitpackage has no public API. The C# test did not notice because it is compiled together withlwk.csin the same assembly. The generator keeps its FFI helper types (FfiConverter,RustBuffer, ...)internal.Verification
Built
lwk_bindingsin release and generated the bindings with the pinneduniffi-bindgen-cs(v0.11.1+v0.31.0) plusscripts/patch_csharp_finalize.py, then compiled the output as a library and referenced it from a separate console project:internaldeclarations, and the consumer fails withCS0122: 'Network' is inaccessible due to its protection levelpublicand 4internaldeclarations; the consumer builds with no errors or warnings and runs (Network.Testnet(),Mnemonic.FromRandom(12),Signer,WpkhSlip77Descriptor()with the native lib next to it)Checked on macOS arm64 with .NET SDK 10.0.201 and a
net10.0project; the repo's own targets (net8.0, Windows) were not built.Notes
LiquidWalletKit.csprojand thebuild-nugetjob still hard-code 0.8.2 (there is a TODO in the workflow), so I left versioning alone..nupkgwould catch a regression of this kind, since the current test can't. Happy to add it here or in a follow-up if you want it.