Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C#] ToString() affects the message state #992

Open
amibar opened this issue Apr 25, 2024 · 0 comments · May be fixed by #993
Open

[C#] ToString() affects the message state #992

amibar opened this issue Apr 25, 2024 · 0 comments · May be fixed by #993

Comments

@amibar
Copy link

amibar commented Apr 25, 2024

The generated ToString() method of a message affects the state of the message.
Since the debugger calls to ToString() to show its data in the watches, it messes up with the state of the program.

Moreover, quoting from the ToString() documents "Notes to Inheritors": https://learn.microsoft.com/en-us/dotnet/api/system.object.tostring

  • Your ToString() override should have no observable side effects to avoid complications in debugging. For example, a call to the ToString() method should not change the value of instance fields.
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 a pull request may close this issue.

1 participant