My c++ project fails to load, but blueprints works fine in UE5

When i try to load up a new project this error pops up.

It says stuff like

System.OutOfMemoryException: Exception of type ‘System.OutOfMemoryException’ was thrown.

Running C:/Program Files/Epic Games/UE_5.1/Engine/Build/BatchFiles/Build.bat -projectfiles -project=“D:/UnrealGameProjects/FireAtCommandTest/FireAtCommandTest.uproject” -game -rocket -progress
Running UnrealBuildTool: dotnet “…..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll” -projectfiles -project=“D:/UnrealGameProjects/FireAtCommandTest/FireAtCommandTest.uproject” -game -rocket -progress
Log file: C:\Users\Admin\AppData\Local\UnrealBuildTool\Log_GPF.txt

Some Platforms were skipped due to invalid SDK setup: IOS, Android, Linux, LinuxArm64.
See the log file for detailed information

Discovering modules, targets and source code for project…
Binding IntelliSense data…
Binding IntelliSense data… 100%
Writing project files…
Writing project files… 0%
Unhandled exception: System.OutOfMemoryException: Exception of type ‘System.OutOfMemoryException’ was thrown.
at System.Text.StringBuilder.ToString()
at UnrealBuildTool.VCProjectFile.WriteProjectFile(List1 InPlatforms, List1 InConfigurations, PlatformProjectGeneratorCollection PlatformProjectGenerators, ILogger Logger) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\ProjectFiles\VisualStudio\VCProject.cs:line 1381
at UnrealBuildTool.ProjectFileGenerator.WriteProjectFiles(PlatformProjectGeneratorCollection PlatformProjectGenerators, ILogger Logger) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\ProjectFiles\ProjectFileGenerator.cs:line 2812
at UnrealBuildTool.VCProjectFileGenerator.WriteProjectFiles(PlatformProjectGeneratorCollection PlatformProjectGenerators, ILogger Logger) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\ProjectFiles\VisualStudio\VCProjectFileGenerator.cs:line 480
at UnrealBuildTool.ProjectFileGenerator.GenerateProjectFiles(PlatformProjectGeneratorCollection PlatformProjectGenerators, String[] Arguments, ILogger Logger) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\ProjectFiles\ProjectFileGenerator.cs:line 1176
at UnrealBuildTool.GenerateProjectFilesMode.Execute(CommandLineArguments Arguments, ILogger Logger) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Modes\GenerateProjectFilesMode.cs:line 233
at UnrealBuildTool.UnrealBuildTool.Main(String[] ArgumentsArray) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.cs:line 648

5 Likes

Not very helpful to the OP but I am also getting the same error when trying to create C++ projects in Unreal 5.1.

Actions taken with no results:
Upgrade Visual Studio to latest version of 2022
Changed Source Code preference in the editor to Visual Studio 2022
Tried to create both a Blank and Third Person C++ project
Confirmed it is not a physical memory issue

2 Likes

same issue here

@roccodimaio
Are you also updating your .NET Core when updating Visual Studio?
-Zen

Same issue for me. Creating a new C++ project in 5.0 works fine but 5.1 throws ‘System.OutOfMemoryException’. 5.1 Blueprint project works fine as well.
I did a reinstall of Visual Studio and Unreal, redownloaded and installed the necessary packages but the issue still persists.

2 Likes

I was able to solve this issue by updating my .NET sdk to 7.0.100 and restarting the computer.

1 Like

I was hoping that your solution would fix the issue for me, but it didn’t unfortunately.

Would you mind listing the following details of your install?

  • Visual Studio Version
  • Screenshot of all the components installed
  • Your Windows version

I’ve been trying to fix this issue for 1 week now, without success so far. It’s clearly a dependency that’s missing, most probably related to a .NET component, but I can’t find the missing one.

What I have tried so far:

  • Clean install and attempt with VS 2019 and also 2022 and following the 5.1 Visual Studio setup documentation page. Clean install of the engine. Same error. I even tried on another computer that never had Unreal Engine or VS installed on.

  • Installing .NET sdk to 7.0.100 and rebooting.

Thanks!

I am using VS 2022 - 17.4.1

These are the installed components

And options

image

image

My Windows version is 10.0.22621


When I was trying to fix the issue I noticed, that my .NET was installed in C:\programs\dotnet and i still had an old sdk version in C:\programs (x86)\dotnet.
I then copied the newer sdk over.
Maybe that will fix the problem for you aswell.

6 Likes

It’s working. I did not install or remove anything from my current configuration but like you, I also had another install of .NET in C:\programs (x86)\dotnet. Copied the newest install over this one and now it works. Something is wrong with the installation process then.

Thank you!

6 Likes

Same for me the old dotnet folder was messing around…
Thank you!

3 Likes

Same problem. I can only open a 5.1.1 project in BP. A C++ project throws an exception:
Unhandled exception: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.

Win10, VS2019.

Where can I find the .NET SDK you are copying over?

I have:
C:\Program Files (x86)\dotnet\sdk\3.1.409
A:\Software\Epic\UE_5.1\Engine\Binaries\ThirdParty\DotNet\6.0.302\{etc}

I found this solution here for this same problem.

3 Likes

The old one is: C:\Program Files (x86)\dotnet

And the new one is: C:\Program Files\dotnet.

Copy the content of the new one to the old one.

1 Like

it save me. :+1: :+1: :+1: :+1: