I have Visual Studio 2017 version 15.2 (26430.16) installed and 4.17 preview 3 refuses to compile my project after one or two times. Below is the error message.
1>------ Build started: Project: HelixOrigin, Configuration: DebugGame_Editor x64 ------
1>Performing full C++ include scan (building a new target)
1>EXEC : error : System.ArgumentNullException: Value cannot be null.
1>Parameter name: source
1> at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
1> at UnrealBuildTool.ExternalExecution.ExecuteHeaderToolIfNecessary(BuildConfiguration BuildConfiguration, UEBuildTarget Target, CppCompileEnvironment GlobalCompileEnvironment, List`1 UObjectModules, FileReference ModuleInfoFileName, ECompilationResult& UHTResult)
1> at UnrealBuildTool.UnrealBuildTool.RunUBT(BuildConfiguration BuildConfiguration, String] Arguments, FileReference ProjectFile)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(44,5): error MSB3075: The command ""D:\Epic Games\UE_4.17\Engine\Build\BatchFiles\Build.bat" HelixOriginEditor Win64 DebugGame "E:\Unreal Projects\HelixOrigin\HelixOrigin.uproject" -waitmutex" exited with code 5. Please verify that you have sufficient rights to run this command.
1>Done building project "HelixOrigin.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Time Elapsed 00:00:00.693
Workaround so far is to switch solution configuration from Development Editor to DebugGame Editor. Then it compiles but if I try to compile again, it fails with the above message for both solution configurations. So final solution is to close VS completely and start again.
I’m seeing the same thing - 4.17 preview 3 projects will only compile a few times before getting this error. After that, I have to clean the solution in order to build again.
Best workaround I’ve found is to touch (just force a change to file write time by adding+deleting a character then saving) a module .Build.cs file to force makefile regeneration. It won’t result in unnecessary C++ compilation.
I’ve tried modifying the Build.cs to generate a new makefile, I’m still getting the same error:
1>------ Build started: Project: ECGame, Configuration: DebugGame_Editor x64 ------
1> Performing full C++ include scan (building a new target)
1> Creating makefile for ECGameEditor (no existing makefile)
1>EXEC : error : System.ArgumentException: An item with the same key has already been added.
1> at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
1> at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
1> at UnrealBuildTool.UEBuildTarget.Build(BuildConfiguration BuildConfiguration, CPPHeaders Headers, List`1 OutputItems, List`1 UObjectModules, ActionGraph ActionGraph)
1> at UnrealBuildTool.UnrealBuildTool.RunUBT(BuildConfiguration BuildConfiguration, String] Arguments, FileReference ProjectFile)
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets(41,5): error MSB3075: The command "C:\UE4_Builds\UE4_Eclipse\Engine\Build\BatchFiles\Build.bat ECGameEditor Win64 DebugGame "E:\P4\JBaxter_Work\Eclipse\Eclipse_Steam\ECGame\ECGame.uproject" -waitmutex" exited with code 5. Please verify that you have sufficient rights to run this command.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Sorry guys. I’m not sure how this one slipped through the cracks.
It was a fairly late change we made to fix an issue with UHT not rebuilding script plugins from installed builds, and the properties it uses are nulled out when building from a UBT makefile.
Thanks Ben. Could you also just quickly have a look into the issue I posted above yours? I’m not sure if it’s related, but improved logging there would have made it much easier to fix!
I’ve submitted a fix for this to a development stream, but it’s not visible on GitHub yet. We’ll include it in the 4.17.2 hotfix (we’ve already stopped taking changes for the 4.17.1 hotfix to try and get the other issue on this thread out of the door). The fix is to insert a check that the Instance.Modules list doesn’t already contain a module in the UEBuildTarget.AddPlugin function here (in Engine/Source/Programs/UnrealBuildTool/Configuration/UEBuildTarget.cs):
// Create modules for this plugin
UEBuildBinaryType BinaryType = ShouldCompileMonolithic() ? UEBuildBinaryType.StaticLibrary : UEBuildBinaryType.DynamicLinkLibrary;
if (Info.Descriptor.Modules != null)
{
foreach (ModuleDescriptor ModuleInfo in Info.Descriptor.Modules)
{
if (ModuleInfo.IsCompiledInConfiguration(Platform, TargetType, Rules.bBuildDeveloperTools, Rules.bBuildEditor, Rules.bBuildRequiresCookedData))
{
UEBuildModule Module = FindOrCreateModuleByName(ModuleInfo.Name, PluginReferenceChain);
// BEGIN PATCH
if(!Instance.Modules.Contains(Module))
{
// END PATCH
if (!Module.RulesFile.IsUnderDirectory(Info.Directory))
{
throw new BuildException("Plugin '{0}' (referenced via {1}) does not contain the '{2}' module, but lists it in '{3}'.", Info.Name, ReferenceChain, ModuleInfo.Name, Info.File);
}
Instance.bDescriptorNeededAtRuntime = true;
Instance.Modules.Add(Module);
// BEGIN PATCH
}
// END PATCH
}
}
}
I’m still getting this error after installing the QFE, at least when editing project plugin code. I have to generate project files every time i compile.