Class MethodContext
Represents a D-Bus method call that is being handled.
public sealed class MethodContext : IDisposable
- Inheritance
-
MethodContext
- Implements
- Inherited Members
Properties
Connection
Gets the D-Bus connection associated with this method call.
[Obsolete("Use DBusConnection instead.")]
public Connection Connection { get; }
Property Value
DBusConnection
Gets the D-Bus connection associated with this method call.
public DBusConnection DBusConnection { get; }
Property Value
DisposesAsynchronously
Gets or sets a value indicating whether the method will be handled and disposed asynchronously.
public bool DisposesAsynchronously { get; set; }
Property Value
Remarks
When this is set to true, the context must be disposed.
IsDBusIntrospectRequest
Gets a value indicating whether this is an Introspect request to the org.freedesktop.DBus.Introspectable interface.
public bool IsDBusIntrospectRequest { get; }
Property Value
IsPropertiesInterfaceRequest
Gets a value indicating whether this is a request to the org.freedesktop.DBus.Properties interface.
public bool IsPropertiesInterfaceRequest { get; }
Property Value
NoReplyExpected
Gets a value indicating whether no reply is expected for this method call.
public bool NoReplyExpected { get; }
Property Value
ReplySent
Gets a value indicating whether a reply has been sent.
public bool ReplySent { get; }
Property Value
Request
Gets the request message.
public Message Request { get; }
Property Value
RequestAborted
Gets a cancellation token that is cancelled when the request is aborted.
public CancellationToken RequestAborted { get; }
Property Value
Methods
CreateReplyWriter(string?)
Creates a MessageWriter for writing the method reply.
public MessageWriter CreateReplyWriter(string? signature)
Parameters
signaturestringThe signature of the reply body, or null if empty.
Returns
- MessageWriter
A MessageWriter for writing the reply.
Disconnect(Exception)
Disconnects the D-Bus connection with the specified exception.
public void Disconnect(Exception exception)
Parameters
exceptionExceptionThe exception indicating the reason for disconnection.
Dispose()
Disposes the method context and sends a default reply if needed.
public void Dispose()
Reply(MessageBuffer)
Sends a reply message.
public void Reply(MessageBuffer message)
Parameters
messageMessageBufferThe message to send.
ReplyError(string?, string?)
Sends an error reply.
public void ReplyError(string? errorName = null, string? errorMsg = null)
Parameters
errorNamestringThe error name, or null to use a default.
errorMsgstringThe error message, or null if none.
ReplyIntrospectXml(ReadOnlySpan<ReadOnlyMemory<byte>>)
Sends an introspection XML reply.
public void ReplyIntrospectXml(ReadOnlySpan<ReadOnlyMemory<byte>> interfaceXmls)
Parameters
interfaceXmlsReadOnlySpan<ReadOnlyMemory<byte>>The interface XML fragments to include in the introspection.
ReplyUnknownMethodError()
Sends an "Unknown Method" error reply.
public void ReplyUnknownMethodError()