C
C#13mo ago
__dil__

❔ Rider's "cleanup on save" adds named parameters seemingly at random

I have a function with this signature:
public bool GetTelemetryData(
ref int serialNum,
out int batteryPercentage,
out int distanceDrivenInMeters
) { ... }
public bool GetTelemetryData(
ref int serialNum,
out int batteryPercentage,
out int distanceDrivenInMeters
) { ... }
Then, when I call it like so:
public string GetBatteryUsagePerMeter(int serialNum)
{
var validSerialNum = _car.GetTelemetryData(
ref serialNum, // <-- It happens here
out var batteryPercentage,
out var distanceDrivenInMeters
);

...
}
public string GetBatteryUsagePerMeter(int serialNum)
{
var validSerialNum = _car.GetTelemetryData(
ref serialNum, // <-- It happens here
out var batteryPercentage,
out var distanceDrivenInMeters
);

...
}
Rider will automatically add a named parameter like serialNum: ref serialNum,. It only adds it to this particular parameter. I don't understand why? I there's a particular reason I'm happy to keep it as is, but it just seems random. Anybody knows what's happening?
2 Replies
joren
joren13mo ago
I assume its because of your GetTelemetryData() signature, which is: GetTelemetryData( ref int serialNum, .... It sees it expects a reference, and therefore Rider passes the serialNum as reference.
Accord
Accord13mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server