Skip to content

Conversation

@sonyps5201314
Copy link

There's a problem with the ComputeIsRecord function. It appears to only check whether the current class has functions like ToString, PrintMembers, and GetHashCode.

public abstract Parameter <Clone>$();
public sealed override string ToString();
protected virtual bool PrintMembers(StringBuilder builder);

In reality, as shown above, functions like ToString and PrintMembers are inherited, so as long as the class isn't a base class, these member functions don't need to exist in the current class.

https://github.com/restsharp/RestSharp/blob/dev/src/RestSharp/Parameters/BodyParameter.cs
before:
image
after:
image

@sonyps5201314 sonyps5201314 force-pushed the fix_inherited_record_identify branch from 5234969 to 4c80484 Compare October 14, 2025 18:01
@sonyps5201314 sonyps5201314 force-pushed the fix_inherited_record_identify branch from 4c80484 to adb41f8 Compare October 20, 2025 14:07
siegfriedpammer added a commit that referenced this pull request Nov 2, 2025
…ssarily declare a ToString override, as the core logic is in PrintMembers.
@siegfriedpammer
Copy link
Member

Unfortunately, your solution breaks the laziness of MetdataTypeDefinition by having to materialize all properties and methods when evaluating the IsRecord property. This is not acceptable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants