KirillOsenkov / MSBuildStructuredLog

A logger for MSBuild that records a structured representation of executed targets, tasks, property and item values.
MIT License
1.42k stars 188 forks source link

System.ArgumentOutOfRangeException #630

Closed TFTomSun closed 1 year ago

TFTomSun commented 1 year ago

I got a exception that seem to come from the structured log viewer: System.ArgumentOutOfRangeException: Kapazität lag unter der aktuellen Größe. Parametername: value bei System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) bei System.Collections.Generic.List1.set_Capacity(Int32 value) bei Microsoft.Build.Logging.StructuredLogger.TreeNode.EnsureChildrenCapacity(Int32 capacity) in C:\MSBuildStructuredLog\src\StructuredLogger\ObjectModel\TreeNode.cs:Zeile 59. bei Microsoft.Build.Logging.StructuredLogger.Construction.AddProperties(TreeNode parent, IEnumerable1 properties, IProjectOrEvaluation project) in C:\MSBuildStructuredLog\src\StructuredLogger\Construction\Construction.cs:Zeile 1061. bei Microsoft.Build.Logging.StructuredLogger.Construction.BuildStarted(Object sender, BuildStartedEventArgs args) in C:\MSBuildStructuredLog\src\StructuredLogger\Construction\Construction.cs:Zeile 96.

Unfortunately I don't have any idea what the root cause could be. Never had that problem before.

image

KirillOsenkov commented 1 year ago

Does it reproduce every time when you open that binlog or does it work fine sometimes?

TFTomSun commented 1 year ago

I used the VS Integration for generating the binlog and opening the log viewer 'external'. I got it on every rebuild. Now, after a Visual Studio restart it seems to be gone.

KirillOsenkov commented 1 year ago

You could see if you still have that binlog on disk in that temp folder location. If yes, try just double-clicking the file on disk to open in the binlog viewer. If it's still broken then we have a good repro. You could then email the binlog privately to me so I can investigate. But if not, that's OK too. Next time you see this, try opening the binlog again in the viewer and see if you see this every time.

KirillOsenkov commented 1 year ago

The VS integration is known to produce corrupt binlogs, that are not very useful.

Instead, look into MSBUILDDEBUGONSTART and read these docs: https://github.com/dotnet/msbuild/blob/e868d91a40fb59cd258844a8d31114c1c3fabf2a/documentation/wiki/Building-Testing-and-Debugging-on-Full-Framework-MSBuild.md#logs

This is a way to get proper binlogs from Visual Studio builds.

KirillOsenkov commented 1 year ago

I fixed this in https://github.com/KirillOsenkov/MSBuildStructuredLog/commit/c1376ed776d98fb404a389a1e6eb2762d33bbdd6