mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-17 18:40:33 +00:00
fix: Weaver SyncVarAttributeAccessReplacer now detects modifying [SyncVar] in another assembly and logs an error, instead of silently failing at runtime (#3525)
This commit is contained in:
parent
5fd5d0e238
commit
7e5bf5ba39
@ -82,6 +82,20 @@ static int ProcessInstruction(Logger Log, SyncVarAccessLists syncVarAccessLists,
|
||||
{
|
||||
ProcessSetInstruction(syncVarAccessLists, md, instr, opFieldst);
|
||||
}
|
||||
// operand is a FieldReference in another assembly?
|
||||
// this is not supported just yet.
|
||||
// compilation error is better than silently failing SyncVar serialization at runtime.
|
||||
// https://github.com/MirrorNetworking/Mirror/issues/3525
|
||||
else if (instr.Operand is FieldReference opFieldstRef)
|
||||
{
|
||||
// [SyncVar]?
|
||||
FieldDefinition field = opFieldstRef.Resolve();
|
||||
if (field.HasCustomAttribute<SyncVarAttribute>())
|
||||
{
|
||||
// TODO support this: accessList needs refs; and need two passes?
|
||||
Log.Error($"'{md.FullName}' in {md.Module.Name} modifies '[SyncVar] {opFieldstRef.Name}' in another assembly: {field.Module.Name}. This is not supported yet, and would silently fail serialization at runtime. Please move the [SyncVar]'s type into the same Assembly.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ldfld (load value of a field)?
|
||||
|
Loading…
Reference in New Issue
Block a user