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
[2024-02-19T22:04:57.896Z] Function 'NumbersToWordsFunction', Invocation id '1c7e2c25-32c6-4027-b30b-f29216597cfa': An exception was thrown by the invocation.
[2024-02-19T22:04:57.897Z] Result: Function 'NumbersToWordsFunction', Invocation id '1c7e2c25-32c6-4027-b30b-f29216597cfa': An exception was thrown by the invocation.
Exception: System.InvalidOperationException: Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead.
...
Changing the following WriteString to WriteStringAsync fixed the issue.
if (long.TryParse(amount, out long number))
{
response = req.CreateResponse(System.Net.HttpStatusCode.OK);
//response.WriteString(number.ToWords());
response.WriteStringAsync(number.ToWords());
}
else
{
response = req.CreateResponse(
System.Net.HttpStatusCode.BadRequest);
//response.WriteString($"Failed to parse: {amount}");
response.WriteStringAsync($"Failed to parse: {amount}");
}
I had the same issue. I used option#2 above and it works fine now.
Your examples, Mark, have been spot on throughout my going through the book - except for the gotchas that have already been discussed. I have really enjoyed the ability to move forward constantly.
I got the following error:
Changing the following WriteString to WriteStringAsync fixed the issue.
or adding the following lines to program.cs (this option was found on stack overflow.
https://stackoverflow.com/a/55196057
The text was updated successfully, but these errors were encountered: