Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andreibosco/4bce3c5a73b43b336fea5b3850802349 to your computer and use it in GitHub Desktop.
Save andreibosco/4bce3c5a73b43b336fea5b3850802349 to your computer and use it in GitHub Desktop.
Unreal 5.4 and Rider Compilation Issue Fix

If unreal 5.4 is not compiling on rider and returning Unhandled exception: System.ArgumentNullException: Value cannot be null. (Parameter 'element'), try this solution by Sam_Swain.

Source: https://forums.unrealengine.com/t/ubt-bug-no-longer-able-to-compile-plugins-in-standalone-since-5-3/1318659/11


Hacking around I managed to both a) identify the problem plugins, and b) make the build tool immune to this crash.

  1. Open C:\Program Files\Epic Games\UE_5.4\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.sln in Visual Studio
  2. Make Configuration/ModuleRules.cs writable
  3. Find the IsValidForTarget method
  4. Replace the first line of code with the code below.
  5. Compile with Build → Build Solution (make sure it completes ok and says it’s updated the C:\Program Files\Epic Games\UE_5.4\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll file.
  6. Attempt to build your project/plugin again
  7. Look in the “C:\Users_yourusername_\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+Program+Files+Epic+Games+UE_5.4” or similar folder for the .txt file with the long name.
  8. In it search for “Does not support” and see if the new code has triggered. The start of the line will tell you the plugin.
			IEnumerable<TargetType> supportedTargetTypes = new TargetType[] { };
			try
			{
				supportedTargetTypes = moduleType
					.GetCustomAttributes<SupportedTargetTypesAttribute>().SelectMany(x => x.TargetTypes).Distinct();
			}
			catch
			{
				string module_name = (moduleType != null) ? moduleType.Name : "<null>";
				invalidReason = $"TargetType '{targetRules.Type}' : Failed to get SupportedTargetTypesAttribute from '{module_name}'";
				return false;
			}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment