"System.OutOfMemoryException was thrown" adding c++ classes or generating visual studio project files ( UE 5.1 )

Had the same problem on clean install of the windows, the proposed solution fixed the error but I think this problem needs to be addressed properly