EnumProcessModulesEx can fail for reasons known as an operating system issue, so we increase the number of attempts we try so failures don't stop the injection process.
Also, EnumProcessModules is not a reliable method to get the modules for a process.
If OS loader is touching module information, this method might fail and copy part of the data.
This is no easy solution to this problem. The only reliable way to fix this is to
suspend all the threads in target process. Of course we don't want to do this in Process class.
So we just to try avoid the race by calling the same method 50 (an arbitrary number) times.
EnumProcessModulesEx can fail for reasons known as an operating system issue, so we increase the number of attempts we try so failures don't stop the injection process.
See here for more information:
https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Win32.cs#L101