nightroman / Invoke-Build

Build Automation in PowerShell

Home Page:https://github.com/nightroman/Invoke-Build/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Do not wrap internal errors in Resolve-MSBuild

nightroman opened this issue · comments

A Resolve-MSBuild error was reported: "Collection was modified; enumeration operation may not execute."
From the log, it is not clear where it is in Resolve-MSBuild.

Known details:

  • Resolve-MSBuild is used indirectly as use * MSBuild (legacy way)
  • It happens in Build-Parallel scenario (relevant?)
  • It is not always reproduced

For now, do not catch and wrap internal errors, to see location in logs.
For known user errors, explicitly use Write-Error.

Recommend using Resolve-MSBuild directly: Set-Alias MSBuild (Resolve-MSBuild *)
(at least to reduce the number of moving parts, use adds another layer of complexity)