I am writing some performance tests and want to be able to use a method that is asynchronous. The code looks like this: action- Func<Task<HttpResponseMessage>>:
var sw = new Stopwatch();
HttpResponseMessage response = null;
sw.Start();
response = await action().ConfigureAwait(continueOnCapturedContext: false);
sw.Stop();
The code compiles and works fine, but the measured milliseconds are approximately 100 times higher than the query timings that we see in Fiddler-Fiddler, it reports 200-300 ms, but the stopwatch reports ~ 30 000 ms. Is there any catch about temporary asynchronous methods? Is the decision to make time in the action itself (which would be annoying?)
source
share