Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Revert "Fixing Array Writing" #68

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

steffen-kiess
Copy link
Contributor

I think this change is broken:

When MessageWriter.Write(object) is called, a variant should be written (see also the comment above the method). If the object is an array, a variant containing the array should be written. A array which is not in a variant can be written using MessageWriter.Write(Type,object) or MessageWriter.WriteArray(T).

If the code somewhere calls MessageWriter.Write(object) when a plain array is needed, the caller should be fixed.

Currently, this change breaks returning an array as a variant, e.g. for the following service:

using System;
using DBus;
[Interface ("test.test")]
public interface TestInterface {
  object GetVal ();
}
public class Test : TestInterface {
  public object GetVal () { return new int[3] { 1, 2, 3 }; }
  public static void Main () {
    Bus bus = Bus.Session;
    bus.RequestName ("test.test");
    bus.Register (new ObjectPath ("/test/test"), new Test ());
    while (true)
      bus.Iterate ();
  }
}

Calling GetVal will disconnect the service:

qdbus --literal test.test /test/test test.test.GetVal
Error: org.freedesktop.DBus.Error.NoReply

Base automatically changed from master to main March 10, 2021 16:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant