March 25, 2015
Async/Await and Recursion
While using the new async/await keywords in C# 5.0 for the first time, I noticed an interesting aspect to how recursive methods behave when using await. For one method I was working on, Resharper notified me of a possible stack overflow exception with a “function is recursive on all paths” warning, but it didn’t fail at runtime. Instead, it continued happily calling itself with no issues.
What keeps it from failing is the use of the await keyword when calling DoWorkAsync().
Read more