Azure DocumentDB sporadically throws SocketException / GoneException

It turned out to be our enterprise Bitdefender Endpoint Security causing the issue. We initially didn't suspect it, since it pretty clearly logged that dotnet.exe was whitelisted and allowed to communicate on the appropriate ports whenever we ran the app. We uninstalled it and the issue went away. We're looking into what exactly it blocked to cause the issue in the first place, but at least we know there's a temporary solution and that the original problem wasn't code-related. Hope this helps someone.