build(ffi): move to the upstream diplomat .NET backend - #518
Draft
irvingouj@Devolutions (irvingoujAtDevolution) wants to merge 1 commit into
Draft
build(ffi): move to the upstream diplomat .NET backend#518irvingouj@Devolutions (irvingoujAtDevolution) wants to merge 1 commit into
irvingouj@Devolutions (irvingoujAtDevolution) wants to merge 1 commit into
Conversation
Swaps the old CBenoit diplomat fork for the rewritten .NET backend, pinned to the blittable-bool fix (rust-diplomat/diplomat#1226) so Result and Option still marshal on .NET Framework. Rust side: DiplomatWriteable is now DiplomatWrite, the bridge macro derives Clone/Copy on enums itself, mutable opaques need opaque_mut, Result errors have to be diplomat types (Pkcs12Error -> Box<PickyError>), and box-in-input is gone (Option<Box<RsString>> -> Option<&RsString>). The generated C# API changes shape: setters are methods (Kid = x becomes SetKid(x)) and enum variants are re-cased (RS512 -> Rs512). Devolutions.Picky itself builds clean; Devolutions.Picky.Tests still needs porting to the new names. Adds Devolutions.Picky.Net48Tests, which runs the bindings on .NET Framework 4.8 and on modern .NET so the marshalling stays proven on both.
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.
Draft — the diplomat side isn't merged yet.
Gets us off the old CBenoit diplomat fork and onto the rewritten .NET backend. Pinned to my rust-diplomat/diplomat#1226 (fixed-width bool tag) because without it every
Result/Optionreturn throwsMarshalDirectiveExceptionon .NET Framework —boolisn't blittable, so P/Invoke can't return the struct by value. Once that lands upstream I'll repoint the rev at rust-diplomat and drop the fork.Rust side had to move with the new backend:
DiplomatWriteable→DiplomatWrite, the bridge macro derivesClone/Copyon enums now, mutable opaques needopaque_mut,Resulterrors must be diplomat types (Pkcs12Error→Box<PickyError>), and box-in-input is gone.builder.Kid = x→builder.SetKid(x)) and enum variants got re-cased (RS512→Rs512,SHA2_256→Sha2256).Still to do:
Devolutions.Picky.Testsdoesn't compile against the new names (56 errors, all mechanical renames). Didn't want to bury it in this diff — happy to do it here or as a follow-up, tell me which.Tests: new
Devolutions.Picky.Net48Testsruns the bindings on net48 and net10, 14/14 on both. Covers every marshalling shape — object/void/primitive/string/option Results, bool in and out,byte[]returns, iterators, error → exception.