affederaffe / Tmds.DBus.SourceGenerator

A roslyn source generator for creating proxies targeting the Tmds.DBus.Protocol API
MIT License
7 stars 5 forks source link

SourceGen'd ValueTuples fails when the target struct has more than 9 members #18

Closed jmacato closed 3 months ago

jmacato commented 3 months ago

God knows why these spec writers at FreeDesktop/AT-SPI did this but they have a crazy struct and this sourcegen fails to compensate with it.

  <interface name="org.a11y.atspi.Collection">
    <method name="GetMatches">
      <arg direction="in" name="rule" type="(aiia{ss}iaiiasib)"/>
        public static (int[], int, Dictionary<string, string>, int, int[], int, string[], int, bool) ReadStruct_raiiaessiaiiasibz(this ref Reader reader)
        {
            reader.AlignStruct();
            return ValueTuple.Create(reader.ReadArray_ai(), reader.ReadInt32(), reader.ReadDictionary_aess(), reader.ReadInt32(), reader.ReadArray_ai(), reader.ReadInt32(), reader.ReadArray_as(), reader.ReadInt32(), reader.ReadBool());
        }

I wonder if it's possible to use a struct instead, though the naming convention for it is something to think about i guess.

affederaffe commented 3 months ago

With https://github.com/affederaffe/Tmds.DBus.SourceGenerator/commit/03cdc8820f9e07ae3c9b8039e7cb5f41b951be26, we now let the compiler chunk big tuples (arity > 7) as per C# spec. Do you mind testing the CI build and see if it fixes the issue?

jmacato commented 3 months ago

yep that fixes it, thanks @affederaffe!