msbuild icon indicating copy to clipboard operation
msbuild copied to clipboard

Consider updating LogErrorFromException to take into account AggregateExceptions

Open jeffkl opened this issue 3 years ago • 2 comments

The TaskLoggingHelper.LogErrorFromException() method should probably take into account an AggregateException and call itself multiple times for each inner exception.

https://github.com/dotnet/msbuild/blob/cc3db358d34ad4cd1ec0c67e17582d7ca2a15040/src/Shared/TaskLoggingHelper.cs#L920

It could also take into account special exceptions like InvalidProjectFileException which have project file information.

Here's what we did in NuGet to get a better experience when MSBuild APIs throw exceptions:

https://github.com/NuGet/NuGet.Client/pull/4809/files#diff-a1e0e948fb5d1439e0368357d8587e83fafe5d5bb1a4f3fad40b040b3b9bf022R1042-R1073

jeffkl avatar Sep 19 '22 21:09 jeffkl

Yeah, we should definitely help here.

rainersigwald avatar Sep 19 '22 21:09 rainersigwald

Originally suggested by @AArnott

jeffkl avatar Sep 19 '22 22:09 jeffkl