SDT1307: Invalid RML Data Event Parameter
| Property | Value |
|---|---|
| Rule ID | SDT1307 |
| Title | Invalid RML Data Event Parameter |
| Category | UI |
| Severity | Error |
Cause
A parameter of a method decorated with [RmlDataEvent] uses parameter modifiers (ref, out, in) or uses an unsupported data type.
Rule Description
Parameters on [RmlDataEvent] methods are unpacked dynamically from expressions in RML markup. The dispatcher does not support passing arguments by reference (ref, out, in). Furthermore, all parameters (excluding an initial RmlEvent parameter) must be of a supported RML data type:
* bool, byte, char, string, int, uint, long, ulong
* ColorRgba, Vector2f, Vector3f, Vector4f
* RmlVariant
* Types implementing IRmlDataArray, IRmlDataStruct, or IRmlDataScalar
How to Fix Violations
Remove any ref, out, or in modifiers, and change the parameter type to a supported primitive, vector, or RML data type.
Violation:
public sealed class SettingsModel(RmlDataModelToken token) : RmlDataModel(token)
{
[RmlDataEvent]
public void OnSaveSettings(in int profileId, System.Uri configUri)
{
// ...
}
}
Fix:
public sealed class SettingsModel(RmlDataModelToken token) : RmlDataModel(token)
{
[RmlDataEvent]
public void OnSaveSettings(int profileId, string configUri)
{
// ...
}
}
When to Suppress Warnings
Danger
Do not suppress this error. Parameters with modifiers or unsupported types cannot be resolved by RmlUi when handling UI events, causing runtime invocation exceptions.