diff --git a/Cargo.lock b/Cargo.lock
index 85494929f..bd6612135 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1318,8 +1318,8 @@ dependencies = [
[[package]]
name = "diplomat"
-version = "0.7.0"
-source = "git+https://github.com/CBenoit/diplomat?rev=6dc806e80162b6b39509a04a2835744236cd2396#6dc806e80162b6b39509a04a2835744236cd2396"
+version = "0.15.0"
+source = "git+https://github.com/irvingoujAtDevolution/diplomat.git?rev=822b0b3effd892ca5babae7c1872d8c6be0685de#822b0b3effd892ca5babae7c1872d8c6be0685de"
dependencies = [
"diplomat_core",
"proc-macro2",
@@ -1329,21 +1329,19 @@ dependencies = [
[[package]]
name = "diplomat-runtime"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f7b0f23d549a46540e26e5490cd44c64ced0d762959f1ffdec6ab0399634cf3c"
+version = "0.15.1"
+source = "git+https://github.com/irvingoujAtDevolution/diplomat.git?rev=822b0b3effd892ca5babae7c1872d8c6be0685de#822b0b3effd892ca5babae7c1872d8c6be0685de"
[[package]]
name = "diplomat_core"
-version = "0.7.0"
-source = "git+https://github.com/CBenoit/diplomat?rev=6dc806e80162b6b39509a04a2835744236cd2396#6dc806e80162b6b39509a04a2835744236cd2396"
+version = "0.15.0"
+source = "git+https://github.com/irvingoujAtDevolution/diplomat.git?rev=822b0b3effd892ca5babae7c1872d8c6be0685de#822b0b3effd892ca5babae7c1872d8c6be0685de"
dependencies = [
- "lazy_static",
"proc-macro2",
"quote",
"serde",
"smallvec",
- "strck_ident",
+ "strck",
"syn 2.0.118",
]
@@ -5653,17 +5651,10 @@ checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
[[package]]
name = "strck"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "be91090ded9d8f979d9fe921777342d37e769e0b6b7296843a7a38247240e917"
-
-[[package]]
-name = "strck_ident"
-version = "0.1.2"
+version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e1c3802b169b3858a44667f221c9a0b3136e6019936ea926fc97fbad8af77202"
+checksum = "42316e70da376f3d113a68d138a60d8a9883c604fe97942721ec2068dab13a9f"
dependencies = [
- "strck",
"unicode-ident",
]
diff --git a/Cargo.toml b/Cargo.toml
index 1df36b015..d27074bfd 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -205,7 +205,3 @@ opt-level = 3
[profile.test.package.rand_chacha]
opt-level = 3
-[patch.crates-io]
-# FIXME: We need to catch up with Diplomat upstream again, but this is a significant amount of work.
-# In the meantime, we use this forked version which fixes an undefined behavior in the code expanded by the bridge macro.
-diplomat = { git = "https://github.com/CBenoit/diplomat", rev = "6dc806e80162b6b39509a04a2835744236cd2396" }
diff --git a/ffi/Cargo.toml b/ffi/Cargo.toml
index b4e6f5e54..00d67c907 100644
--- a/ffi/Cargo.toml
+++ b/ffi/Cargo.toml
@@ -12,8 +12,8 @@ test = false
doctest = false
[dependencies]
-diplomat = "0.7"
-diplomat-runtime = "0.7"
+diplomat = { git = "https://github.com/irvingoujAtDevolution/diplomat.git", rev = "822b0b3effd892ca5babae7c1872d8c6be0685de" }
+diplomat-runtime = { git = "https://github.com/irvingoujAtDevolution/diplomat.git", rev = "822b0b3effd892ca5babae7c1872d8c6be0685de" }
ironrdp = { path = "../crates/ironrdp", features = ["session", "connector", "dvc", "svc", "rdpdr", "rdpsnd", "graphics", "input", "cliprdr", "displaycontrol"] }
ironrdp-cliprdr-native.path = "../crates/ironrdp-cliprdr-native"
ironrdp-dvc-pipe-proxy.path = "../crates/ironrdp-dvc-pipe-proxy"
diff --git a/ffi/dotnet-interop-conf.toml b/ffi/dotnet-interop-conf.toml
index e2c76a3af..5560c858f 100644
--- a/ffi/dotnet-interop-conf.toml
+++ b/ffi/dotnet-interop-conf.toml
@@ -1,10 +1,9 @@
+lib_name = "DevolutionsIronRdp"
+
+[dotnet]
namespace = "Devolutions.IronRdp"
native_lib = "DevolutionsIronRdp"
-
-[exceptions]
-trim_suffix = "Error"
-error_message_method = "ToDisplay"
-
-[properties]
+exception_trim_suffix = "Error"
+exception_message_method = "ToDisplay"
setters_prefix = "set_"
getters_prefix = "get_"
diff --git a/ffi/dotnet/Devolutions.IronRdp.AvaloniaExample/Devolutions.IronRdp.AvaloniaExample.csproj b/ffi/dotnet/Devolutions.IronRdp.AvaloniaExample/Devolutions.IronRdp.AvaloniaExample.csproj
index 802b8ad76..155f7eb05 100644
--- a/ffi/dotnet/Devolutions.IronRdp.AvaloniaExample/Devolutions.IronRdp.AvaloniaExample.csproj
+++ b/ffi/dotnet/Devolutions.IronRdp.AvaloniaExample/Devolutions.IronRdp.AvaloniaExample.csproj
@@ -23,5 +23,9 @@
+
+ DevolutionsIronRdp.dll
+ PreserveNewest
+
diff --git a/ffi/dotnet/Devolutions.IronRdp/Generated/Action.cs b/ffi/dotnet/Devolutions.IronRdp/Generated/Action.cs
index d83abd39e..b47a9aea4 100644
--- a/ffi/dotnet/Devolutions.IronRdp/Generated/Action.cs
+++ b/ffi/dotnet/Devolutions.IronRdp/Generated/Action.cs
@@ -1,11 +1,8 @@
// by Diplomat
-#pragma warning disable 0105
using System;
using System.Runtime.InteropServices;
-
using Devolutions.IronRdp.Diplomat;
-#pragma warning restore 0105
namespace Devolutions.IronRdp;
@@ -13,28 +10,60 @@ namespace Devolutions.IronRdp;
public partial class Action: IDisposable
{
- private unsafe Raw.Action* _inner;
+ private unsafe RustHandle _inner;
+
+ ///
+ /// Roots the wrappers this value borrows from so the GC cannot finalize
+ /// a borrowed-from parent while this value is alive.
+ ///
+ private object[] _edges;
+
+ private static readonly unsafe RustDestructor _destroy = Raw.Action.Destroy;
///
/// Creates a managed Action from a raw handle.
///
///
- /// Safety: you should not build two managed objects using the same raw handle (may causes use-after-free and double-free).
+ /// Safety: you should not build two managed objects using the same raw handle (may cause use-after-free and double-free).
///
/// This constructor assumes the raw struct is allocated on Rust side.
/// If implemented, the custom Drop implementation on Rust side WILL run on destruction.
///
- public unsafe Action(Raw.Action* handle)
+ internal unsafe Action(Raw.Action* handle)
+ {
+ _inner = RustHandle.Owned(handle, _destroy);
+ _edges = System.Array.Empty