This might solve an issue with an infinite loop on very large C# projects.

...dotnet/api/microsoft/ModelFactory.java