Skip to content

Add catch for HostObjectException - #12829

Merged
YuliiaKovalova merged 1 commit into
mainfrom
dev/ykovalova/handle_HostObjectException
Nov 27, 2025
Merged

YuliiaKovalova merged 1 commit into
mainfrom
dev/ykovalova/handle_HostObjectException

Conversation

@YuliiaKovalova

Copy link
Copy Markdown
Member

Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2607107/

Context

It's expected from MSBuild to handle the case with the exception inside of COM object more gracefully.

Comment thread src/Build/Resources/Strings.resx Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds exception handling for HostObjectException in the TaskBuilder component to provide more graceful error handling when COM interop fails while acquiring host objects. Instead of propagating the exception and failing the build, the exception is caught, logged as a warning, and the build continues without the host object.

Key changes:

  • Added try-catch block around GetHostObject() call in TaskBuilder to catch HostObjectException
  • Log caught exceptions as warnings with a new localized error message "HostObjectFailure"
  • Added the new error message resource to all localization files

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.

File Description
src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs Added try-catch for HostObjectException with warning logging
src/Build/Resources/Strings.resx Added new error message resource "HostObjectFailure"
src/Build/Resources/xlf/*.xlf Added localization entries for the new error message (12 language files)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants