FoxPro Debugger Combined with Async Functions
Problem:
A Chilkat FoxPro programmer was calling Rest.FullRequestSbAsync with a 3MB request. It failed with a WSAECONNABORTED error message. However, calling Rest.FullRequestSb works fine. Why?
Answer:
When the async version of a method is called, Chilkat is starting a background thread to call the synchronous version of the method. For example, the Async method returns a Task object. When task.Run is called, the task is scheduled to run on a background thread. It simply calls the synchronous version of the method from the background thread.
There should be no difference.
What did the programmer neglect to divulge? He forgot to say he was stepping through the program in the debugger. He did the following:
I added a SUSP after loTask = loRest.FullRequestSbAsync(…) and started the debugger to get the logs.
After removing the SUSP it works fine.