msbuild icon indicating copy to clipboard operation
msbuild copied to clipboard

Logs an error with code extraction and details

Open JaynieBai opened this issue 4 months ago • 0 comments

Fixes #8785

Context

Re logging, the XslTransformation task calls TaskLoggingHelper.LogErrorWithCodeFromResources(string messageResourceName, params object[] messageArgs). There is also TaskLoggingHelper.LogErrorFromException(Exception exception, bool showStackTrace, bool showDetail, string file), which logs the inner exceptions if requested via the showDetail parameter or the "MSBUILDDIAGNOSTICS" environment variable, but this then does not log an error code

Changes Made

Add a new log method logErrorWithCodeAndException which Logs an error using a resource string (with code extraction and help keyword) and appends exception details.

Testing

XslDocumentFunctionWorks() log output contains message and stack trace image

Notes

JaynieBai avatar May 30 '25 07:05 JaynieBai