We're using nightly nuget packages 2013-03-30. When we're trying to upload large files (for instance > 2Mb) and process it by using HttpContentMultipartExtensions we've got unhandled exception which crashes AppDomain:
"An unhandled exception of type 'System.StackOverflowException' occurred in Unknown Module."
Code sample is straightforward and looks like
After research we've found that in MoveToNextSegmentAsync method exists recursive call:
private static async Task<bool> MoveToNextSegmentAsync(MultipartAsyncContext context)
if (!await MoveToNextSegmentAsync(context))
It was commited by phenning on Feb 26, 2013. Commit 83169ad25a4c:
When large http body is processing this code fragment creates a really huge call stack which causes StackOverflowException and AppDomain crash.