question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MSBuild crashes with an out-of-memory exception when updating GitVersionTask from 4.0.0-beta0013 to 4.0.0

See original GitHub issue

Problem:

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 about 1.2GB of memory, whereas GitVersionTask-4.0.0-beta-0013 consumes 200MB.
  • GitVersion.CommandLine continues to consume the same amount of memory in both the versions. So we believe that updates to GitVersionTask between these two versions causes the problem.
  • GitVersionTask-4.0.0 relies on UtilPack.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:closed
  • Created 5 years ago
  • Comments:17 (17 by maintainers)

github_iconTop GitHub Comments

2reactions
stazzcommented, Mar 19, 2019

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, the NuGetUtils.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.

1reaction
stazzcommented, Mar 18, 2019

I’ve published version 2.0.2 of NuGetUtils.MSBuild.Exec and updated GitVersionTask to use that version. The UpdateAssemblyInfo task now executes successfully.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found