C# bindings: all generated types are `internal`, `LiquidWalletKit` 0.8.2 has no usable public API

Đang mở
#210 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

@lisboaigor đang làm issue này rồi.

Từ ngày 22/11/2026.

  • #211 của @lisboaigor — đang mở

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
csharp, rust
Lĩnh vực
build-system

Hướng nghiên cứu

The generated C# types are internal because lwk_bindings/uniffi.toml has no [bindings.csharp] section, so the default access modifier applies. The proposed fix is access_modifier = "public" in that file, and PR #211 already contains it. Done means a separate consumer project can reference the packed package and compile against Network and Mnemonic. Check the open PR before starting, since this work is already under way.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Summary

The LiquidWalletKit 0.8.2 NuGet package (the one the docs install page tells you to use) can't be consumed: every type in uniffi.lwk (Wollet, Signer, Mnemonic, Network, EsploraClient, TxBuilder, Pset, ... and the I* interfaces) is internal.

Reproduction

Tested with dotnet add package LiquidWalletKit --version 0.8.2 on a new net10.0 class library (.NET SDK 10.0.201, macOS 26.6):

using uniffi.lwk;

var network = Network.Mainnet();
var mnemonic = Mnemonic.FromRandom(12);
error CS0122: 'Network' is inaccessible due to its protection level
error CS0122: 'Mnemonic' is inaccessible due to its protection level

Checking the metadata of LiquidWalletKit.dll confirms it: all 288 TypeDef rows in uniffi.lwk are NotPublic, and I didn't see any InternalsVisibleTo.

Cause

uniffi-bindgen-cs emits internal unless told otherwise (Config::access_modifier() defaults to "internal", documented in its docs/CONFIGURATION.md: "access_modifier - override the default internal access modifier for "exported" uniffi symbols"). lwk_bindings/uniffi.toml has no [bindings.csharp] section, so the published package gets the default.

The C# test (lwk_bindings/tests/bindings/list_transactions.cs) is compiled together with lwk.cs in the same project (justfile, csharp-windows), so it can use internal types and doesn't catch this. build-nuget only runs dotnet build / dotnet pack; nothing consumes the package from outside the assembly.

0.8.2 (2024-11-19) is the only version on NuGet, and master still builds with the same default, so a new release would have the same problem.

Fix

Add this to lwk_bindings/uniffi.toml:

[bindings.csharp]
access_modifier = "public"

I verified it: with the pinned uniffi-bindgen-cs (v0.11.1+v0.31.0), the generated lwk.cs goes from 186 internal declarations to 184 public (the FFI helper types stay internal). A separate consumer project fails with CS0122 before the change and builds and runs after it. Fix: #211

Only a new release will fix the published package, since LiquidWalletKit.csproj and the build-nuget job still hard-code 0.8.2.

A CI step that builds a tiny project against the packed .nupkg would catch this kind of regression, since the current C# test is compiled in the same assembly as lwk.cs. I left it out of the PR; happy to add it if you want it.

Ngôn ngữ chính
Rust
Star
114
Fork
69
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Blockstream/lwk

Tất cả issue của Blockstream/lwk

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.