MSBuild crashes with an out-of-memory exception when updating GitVersionTask from 4.0.0-beta0013 to 4.0.0
See original GitHub issueProblem:
MSBuild.exe crashes with an out-of-memory exception frequently when we try to upgrade GitVersionTask
from 4.0.0-beta0013
to 4.0.0
.
Preconditions:
- The Git repository should be large in terms of number of commits, our repo has > 80k commits.
- MSBuild.exe runs as a 32-bit process. We use the MSBuild supplied with
VS2015
.
Observations:
- We observed that
GitVersionTask-4.0.0
consumes about1.2GB
of memory, whereasGitVersionTask-4.0.0-beta-0013
consumes200MB
. GitVersion.CommandLine
continues to consume the same amount of memory in both the versions. So we believe that updates toGitVersionTask
between these two versions causes the problem.GitVersionTask-4.0.0
relies onUtilPack.NuGet.MSBuild
, could this cause the problem somehow?
This issue is preventing us from upgrading GitVersion and we would really appreciate some feedback or workarounds for this issue.
Issue Analytics
- State:
- Created 5 years ago
- Comments:17 (17 by maintainers)
Top Results From Across the Web
GitVersionTask v4 with an MSBuild-only project
I assume the error must have something to do with this not being a normal .NET project (i.e., with no source code aside...
Read more >FIX: A System.OutOfMemoryException exception occurs or ...
When you click any button that is in the IDE, the IDE responds slowly and even crashes. Note This problem occurs even when...
Read more >System.OutOfMemoryException when trying to build sql ...
After updating from Visual Studio 2019 Version 16.2.5 to 16.3.0 I am no longer able to build my main sql project using the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I am sure this is something that can be improved. The
NuGetUtils.MSBuild.Exec
spawns 3 processes on first run of any task it uses, and 1 process per subsequent run of the similar tasks within the same MSBuild process. If you invoke MSBuild process many times during the build, theNuGetUtils.MSBuild.Exec
loses the cached information and ends up spawning more processes than required. So that one way to improve build times is to minimize the amount of MSBuild invocations.I will also add some diagnostic output for all situations
NuGetUtils.MSBuild.Exec
invokes processes, so that this behaviour can be better tracked, and improved in the future. The current work is only first iteration of the idea of using processes to invoke dynamic tasks in NuGet packages and I am sure there is still plenty of room for improvement.I’ve published version
2.0.2
ofNuGetUtils.MSBuild.Exec
and updatedGitVersionTask
to use that version. TheUpdateAssemblyInfo
task now executes successfully.