Logs an error with code extraction and details #11931
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Notes