Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dbus codegen IdleMonitor and SafeHandle parameterless constructor #305

Closed
altenstedt opened this issue Oct 29, 2024 · 1 comment
Closed

Comments

@altenstedt
Copy link

altenstedt commented Oct 29, 2024

Commit 1f82e0b from PR #289 (release 0.19.0) breaks the code generated by:

dotnet dbus codegen --protocol-api --service org.gnome.Mutter.IdleMonitor

Error CS0310 : 'SafeHandle' must be a non-abstract type with a public parameterless constructor in order to use it as parameter 'T' in the generic type or method 'Reader.ReadHandle()'

protected static SafeHandle? ReadMessage_h(Message message, IdleMonitorObject _)
{
    var reader = message.GetBodyReader();
    return reader.ReadHandle<System.Runtime.InteropServices.SafeHandle>();
}

https://github.com/altenstedt/flextime-net/blob/main/Flextime.Monitor/IdleMonitor.DBus.cs

How can I use dbus codegen for IdleMonitor using 0.19.0 or later?

@tmds
Copy link
Owner

tmds commented Oct 31, 2024

How can I use dbus codegen for IdleMonitor using 0.19.0 or later?

You need to update the tool to a 0.19.0+ version.

It will use SafeFileHandle as the generic parameter. That change is included for the codegen command in the referenced PR.

This breaking change was made to match with the pattern .NET uses to create a SafeHandle in NativeAOT compatible code.

@altenstedt altenstedt closed this as not planned Won't fix, can't repro, duplicate, stale Nov 1, 2024
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

No branches or pull requests

2 participants