IL2CPP generation error for this[] operator override setter
Important
If General, Description, and Replication are not completed the issue will be closed immediately.
General Unity version: 2022.3.15f1 Fish-Networking version: 4.1.2R Discord link: https://discord.com/channels/424284635074134018/1034477094731784302/1218299786860695752
Description In my custom class, I override the array accessor operator, []. Getter works fine, but having a setter results in the error in the attached text file.
The related code is as follows :
Dictionary<Guid, MyClass> Foo = new();
public MyClass this[Guid id]
{
get
{
if (Foo.TryGetValue(id, out MyClass mc)) return mc;
return null;
}
set
{
Foo[id] = value;
}
}
Where serialization is happening for the broadcast struct:
public class ManageMyClass
{
public List<MyClass> MyList;
}
struct BroadcastMe
{
public ManageMyClass Manager;
}
Replication Steps to reproduce the behavior:
- Create a project with a class using the code above
- Build the project with IL2CPP target
- Observe error in log
Expected behavior I'd expect no error with building the code above. It's fundamental and simple C# code.
Are you serializing MyClass anywhere? EG: RPC, SyncVar, Broadcast
Yes, it's in a broadcast struct.
Please update original post to show the struct.
Thanks!
I'm going to mark this as wont fix but keep it open because Id like to see if our new serializer generation tech will fix this.