SDT0603: RPC Validation Signature Mismatch

Property Value
Rule ID SDT0603
Title RPC Validation Signature Mismatch
Category Network
Severity Error

Cause

An RPC validation method exists, but its signature does not match its target RPC method, or it does not return a bool.

Rule Description

Validation methods must have the exact same parameter list as the RPC method they are validating, and they must return a bool to tell the network layer whether to accept or reject the packet.

How to Fix Violations

Update the validation method's return type to bool and copy the exact parameter types and order from the RPC method.

Violation:

[RPC(PacketBroadcast.Client, Validation=nameof(RPC_SpawnItem_Val))]
public void RPC_SpawnItem(int itemId, int quantity) { }

// Violation: Missing parameters, wrong return type
void RPC_SpawnItem_Val(int itemId) { } 

Fix:

[RPC(PacketBroadcast.Client, Validation=nameof(RPC_SpawnItem_Val))]
public void RPC_SpawnItem(int itemId, int quantity) { }

bool RPC_SpawnItem_Val(int itemId, int quantity) 
{
    return quantity > 0;
}

When to Suppress Warnings

Danger

Do not suppress this error. The networking engine cannot bind mismatched signatures at compile time, causing runtime serialization crashes.