Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2013 and Update 2 (Intermittent Build Errors)

When we installed SP2 we started noticing the following when building solutions:

ERROR C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2348,5): Task host node exited prematurely. Diagnostic information may be found in files in the temporary files directory named MSBuild_*.failure.txt. 
ERROR C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2366,7): The "GenerateResource" task's outputs could not be retrieved from the "FilesWritten" parameter. Object does not match target type.

And then looking at one of the MSBuild_*.failure.txt files I see:

UNHANDLED EXCEPTIONS FROM PROCESS 26072:
=====================
5/20/2014 4:18:22 PM
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at System.Collections.Generic.Dictionary`2.Initialize(Int32 capacity)
   at System.Collections.Generic.Dictionary`2..ctor(Int32 capacity, IEqualityComparer`1 comparer)
   at Microsoft.Build.BackEnd.NodePacketTranslator.NodePacketReadTranslator.TranslateDictionary(Dictionary`2& dictionary, IEqualityComparer`1 comparer)
   at Microsoft.Build.BackEnd.TaskParameter.ReadITaskItem(INodePacketTranslator translator, ITaskItem& wrappedItem)
   at Microsoft.Build.BackEnd.TaskParameter.TranslateITaskItemArray(INodePacketTranslator translator)
   at Microsoft.Build.BackEnd.TaskParameter.Translate(INodePacketTranslator translator)
   at Microsoft.Build.BackEnd.TaskParameter.FactoryForDeserialization(INodePacketTranslator translator)
   at Microsoft.Build.BackEnd.NodePacketTranslator.NodePacketReadTranslator.Translate[T](T& value, NodePacketValueFactory`1 factory)
   at Microsoft.Build.BackEnd.NodePacketTranslator.NodePacketReadTranslator.TranslateDictionary[T](Dictionary`2& dictionary, IEqualityComparer`1 comparer, NodePacketValueFactory`1 valueFactory)
   at Microsoft.Build.BackEnd.TaskHostConfiguration.Translate(INodePacketTranslator translator)
   at Microsoft.Build.BackEnd.TaskHostConfiguration.FactoryForDeserialization(INodePacketTranslator translator)
   at Microsoft.Build.BackEnd.NodePacketFactory.PacketFactoryRecord.DeserializeAndRoutePacket(Int32 nodeId, INodePacketTranslator translator)
   at Microsoft.Build.BackEnd.NodePacketFactory.DeserializeAndRoutePacket(Int32 nodeId, NodePacketType packetType, INodePacketTranslator translator)
   at Microsoft.Build.CommandLine.OutOfProcTaskHostNode.DeserializeAndRoutePacket(Int32 nodeId, NodePacketType packetType, INodePacketTranslator translator)
   at Microsoft.Build.BackEnd.NodeEndpointOutOfProcBase.PacketPumpProc()
===================

It seems to happen on the first time we build a solution and then stops happening for awhile and then comes back and then goes away for awhile. Any ideas on how to fix this? I can't be out-of-memory as I am ONLY running VS2013 & a couple of IE instancens on a 64bit system with 8GB of RAM.

like image 673
Denis Avatar asked May 21 '14 19:05

Denis


1 Answers

I was getting exactly the same behaviour after installing VS 2013 Update 2, but not when compiling directly from inside Visual Studio. I got these errors when using msbuild in our separate build scripts (a collection of Windows "bat" files). These scripts were using

C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe

Luckily, the path to this program is configurable for all of our scripts in a single place (by using some kind of include mechanism). I exchanged it by

C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe

and now everything seems to be fine. The latter "MSBuild.exe" seems to be a newer version which was installed as part of the "Upgrade 2", the former is the version belonging to .NET framework 4.

I also tried the amd64 version mentioned by @J.J.Hashemi, but it gave me some nasty warnings about the processor architecture of some framework DLLs not matching my target architecture.

like image 127
Doc Brown Avatar answered Oct 13 '22 23:10

Doc Brown