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

Generated code incorrect for DBus structs in 0.0.12 #6

Closed Ace4896 closed 10 months ago

Ace4896 commented 10 months ago

Hi, after upgrading from 0.0.11 to 0.0.12, I found that the generated code for structs seem to be incorrect. I've created a minimal repro here - master branch is on 0.0.11 and generator-0.0.12 branch on 0.0.12.

It seems to be missing out the last field in structs, like these methods from ReaderExtensions:

// Should be (ObjectPath, byte[], byte[], string)
public static (ObjectPath, byte[], byte[]) ReadStruct_roayaysz(this ref Reader reader)
{
    reader.AlignStruct();
    return ValueTuple.Create(reader.ReadObjectPath(), reader.ReadArray_ay(), reader.ReadArray_ay());
}

// Should be (ObjectPath, byte[], byte[])
public static (ObjectPath, byte[]) ReadStruct_roayayz(this ref Reader reader)
{
    reader.AlignStruct();
    return ValueTuple.Create(reader.ReadObjectPath(), reader.ReadArray_ay());
}
affederaffe commented 10 months ago

Seems like I messed with the SignatureReader which resulted in discarding the last element of structs. Should be fixed with 0.0.13, thanks!

Ace4896 commented 10 months ago

Can confirm that it's fixed in 0.0.13, thanks for the quick update!