|
Bugzilla – Full Text Bug Listing |
| Summary: | [DBus] Can't send struct as object over dbus | ||
|---|---|---|---|
| Product: | [Mono] UI Automation | Reporter: | Rui Guo <rguo> |
| Component: | Client - UIA | Assignee: | E-mail List <mono-a11y-bugs> |
| Status: | NEW --- | QA Contact: | E-mail List <mono-a11y-qa> |
| Severity: | Normal | ||
| Priority: | P5 - None | CC: | mgorse |
| Version: | Unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | Other | ||
| OS: | Other | ||
| Whiteboard: | |||
| Found By: | --- | Services Priority: | |
| Business Priority: | Blocker: | --- | |
| Marketing QA Status: | --- | IT Deployment: | --- |
This may be fixed since we started using ndesk-dbus from git master. from http://www.ndesk.org/DBus_Documentation#D-Bus_variants: New feature in git as of March 2009: If it is not possible to determine the managed equivalent (for example if the received variant contains an anonymous structure, the type and fields of which are unknown), an opaque boxed object is returned. This object may be converted to its actual type, say a managed struct, array or IDictionary<,>, using System.Convert at any later point: object boxedVariant = demo.ComplexAsVariant (); MyStruct actualStruct = (MyStruct)Convert.ChangeType (boxedVariant, typeof (MyStruct)); If MyStruct cannot represent boxedVariant, Convert.ChangeType() will safely throw an InvalidCastException. There is currently no official way to determine the signature of the received boxed variant, as the receiver will typically already know what format to expect based on an enum or string value in that call. Unofficially, ToString() may return the D-Bus signature of the variant as a string which can be helpful when dealing with poorly designed D-Bus interfaces from third parties. However, we recommend that developers treat the boxed opaque object as a strictly sealed and private object, only accessing it with System.Convert. I think we need to test this. When the struct we're talking about is managed, perhaps these issues don't apply. |
E.g. in our UiaDbus code, we have: [Interface (Constants.ApplicationInterfaceName)] public interface IApplication { ... event AutomationPropertyChangedHandler AutomationPropertyChanged; ... } where AutomationPropertyChangedHandler is: public delegate void AutomationPropertyChangedHandler (int handlerId, int eventId, string providerPath, int propertyId, object oldValue, object newValue); And we also have a normal struct named Rect. Then if we fire the event with following code: Rect r = new Rect (10.0, 10.0); AutomationPropertyChanged (123, 123, "path", 123, r, r); The event singal will never reach the remote end. However if we fire the event with these code: var r = new double [] { 10.0, 10.0 }; AutomationPropertyChanged (123, 123, "path", 123, r, r); The event singal will be sent to the remote end w/o any problem. I expect the 1st case can work as well as the 2nd case.