dbus-sharp icon indicating copy to clipboard operation
dbus-sharp copied to clipboard

Unable to handle nested dictionaries

Open mjohnson9 opened this issue 12 years ago • 4 comments

While attempting to implement the Protocols property from the org.freedesktop.Telepathy.ConnectionManager interface, I ran into the fact that IDictionary<string, IDictionary<string, Parameter>> results in a System.ArgumentException: The type of an array must be a single complete type.

Is this intended, or should the library be capable of handling nested dictionaries?

mjohnson9 avatar May 22 '12 13:05 mjohnson9

I got the same issue with the method 'GetSettings()' from 'org.freedesktop.NetworkManager.Settings.Connection'.

Did you find a workaround?

http://projects.gnome.org/NetworkManager/developers/api/09/spec.html#org.freedesktop.NetworkManager.Settings.Connection

Ummon avatar Aug 17 '12 12:08 Ummon

I randomly replace the method content of Signature.MakeDict(..) :

return MakeArray (MakeDictEntry (keyType, valueType));

by

return MakeDictEntry (keyType, valueType);

And it seems to work, but I can't guarantee that's the right solution. A project developer has to confirm this.

Ummon avatar Aug 17 '12 14:08 Ummon

I have the same issue. I have the following connman DBus method:

<method name="GetServices">      <arg name="services" type="a(oa{sv})" direction="out"/>  </method>

With the NDesk implementation, the following worked:

IDictionary<string, IDictionary<string, object>> GetServices();

I made the change that Ummon recommended and everything seems to work now as well. If this isn't the right way to code the interface method, then what would it be?

Jerrill avatar Aug 21 '12 03:08 Jerrill

Issues go stale after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

/lifecycle stale

bnbot avatar Jun 09 '21 10:06 bnbot