Skip to content
This repository has been archived by the owner on May 16, 2022. It is now read-only.

Undefined behaviour while serializing ValueTask<TResult> #219

Open
RamType0 opened this issue May 27, 2020 · 0 comments · May be fixed by #221
Open

Undefined behaviour while serializing ValueTask<TResult> #219

RamType0 opened this issue May 27, 2020 · 0 comments · May be fixed by #221

Comments

@RamType0
Copy link

ValueTask<TResult> had breaking changes in .NET Core 2.1.
Accessing ValueTask<TResult>.Result before it completes could cause undefined behaviour.

public void Serialize(ref JsonWriter writer, ValueTask<T> value, IJsonFormatterResolver formatterResolver)
{
// value.Result -> wait...!
formatterResolver.GetFormatterWithVerify<T>().Serialize(ref writer, value.Result, formatterResolver);
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant