You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While trying to write a custom formatter for a complex type I hit a problem where the write phase was producing illegal output which seemed to be caused by a missing field write. I have now tracked this down to a missing ref on an extension method.
The MessagePackWriter is a struct for performance reasons and if the ref is omitted a copy will happen here. The write advance is applied to the copy and then lost when the method returns. This leads to the write vanishing in this case. This is a subtle and hard to diagnose pit of failure.
I suggest that an analyzer be added looking at the use of MessagePackReader and MessagePackWriter in parameter lists which check to see if they are being passed by ref and if they aren't producing an error.
The text was updated successfully, but these errors were encountered:
Not a bad idea. If you send a PR for it yourself, be sure you target the develop branch, as there have been a lot of changes between that and master (our default branch).
While trying to write a custom formatter for a complex type I hit a problem where the write phase was producing illegal output which seemed to be caused by a missing field write. I have now tracked this down to a missing
ref
on an extension method.The
MessagePackWriter
is a struct for performance reasons and if theref
is omitted a copy will happen here. The write advance is applied to the copy and then lost when the method returns. This leads to the write vanishing in this case. This is a subtle and hard to diagnose pit of failure.I suggest that an analyzer be added looking at the use of
MessagePackReader
andMessagePackWriter
in parameter lists which check to see if they are being passed by ref and if they aren't producing an error.The text was updated successfully, but these errors were encountered: