WebAPIContrib.Core icon indicating copy to clipboard operation
WebAPIContrib.Core copied to clipboard

System.InvalidOperationException: Synchronous operations are disallowed. Call ReadAsync or set AllowSynchronousIO to true instead.

Open AnthonyMastrean opened this issue 4 months ago • 0 comments

The EndOfStream call in the CSV input formatter is synchronous and causes the model binder to throw an exception due to this breaking change.

System.InvalidOperationException: Synchronous operations are disallowed. Call ReadAsync or set AllowSynchronousIO to true instead.

That loop condition can be changed to something like this:

string line;
while ((line = await reader.ReadLineAsync()) != null)

AnthonyMastrean avatar Apr 23 '24 19:04 AnthonyMastrean