Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 11, 2025

Context

Structured log viewer was cluttered with repeated non-actionable messages about SDK environment variables (e.g., DOTNET_HOST_PATH). These appeared for every project evaluation, reporting normal SDK behavior without providing value to users.

Changes Made

Removed three LogComment calls from ProjectInstance.AddSdkResolvedEnvironmentVariable():

  • Message when environment variable already set as process environment variable
  • Message when environment variable already set by another SDK
  • Message when successfully setting environment variable

Removed unused string resources that were referenced by the deleted log messages:

  • SdkEnvironmentVariableAlreadySet
  • SdkEnvironmentVariableAlreadySetBySdk
  • SdkEnvironmentVariableSet

These resources were removed from Strings.resx and all 13 localized .xlf files (cs, de, es, fr, it, ja, ko, pl, pt-BR, ru, tr, zh-Hans, zh-Hant).

The underlying functionality is unchanged—environment variables are still tracked and set correctly, just without the logging noise.

Testing

  • Built MSBuild successfully
  • Verified messages no longer appear in build logs at any verbosity level
  • Confirmed existing unit tests pass
  • Verified sample projects build successfully after resource cleanup

Notes

The removed messages logged at MessageImportance.Low but still appeared prominently in structured log viewer output. Since they report expected behavior rather than issues requiring user action, logging adds no value. The cleanup of unused string resources reduces maintenance burden and keeps the codebase clean.

Original prompt

This section details on the original issue you should resolve

<issue_title>Duplicated messages from SDK/environment resolution</issue_title>
<issue_description>Image

There are a ton of these An SDK attempted to set the environment variable "DOTNET_HOST_PATH" messages that aren't particularly helpful, and they're not attributed to a project so they clutter up the top level of the viewer tool.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

These log messages were cluttering the structured log viewer with repeated
messages about DOTNET_HOST_PATH and other SDK environment variables. Since
these messages report normal expected behavior and aren't actionable for
users, they have been removed entirely.

Co-authored-by: YuliiaKovalova <[email protected]>
Copilot AI changed the title [WIP] Fix duplicated messages from SDK/environment resolution Remove duplicate SDK environment variable log messages Dec 11, 2025
Copilot AI requested a review from YuliiaKovalova December 11, 2025 08:46
// If the property has already been set as an environment variable, we do not overwrite it.
if (_environmentVariableProperties.Contains(name))
{
_loggingContext.LogComment(MessageImportance.Low, "SdkEnvironmentVariableAlreadySet", name, value);
Copy link
Member

Choose a reason for hiding this comment

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

@copilot do we need these strings in other places?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! The string resources were not used anywhere else in the codebase. I've removed them from Strings.resx and all localized .xlf files in commit 743e2d2.

The string resources SdkEnvironmentVariableAlreadySet,
SdkEnvironmentVariableAlreadySetBySdk, and SdkEnvironmentVariableSet
are no longer used after removing the log messages that referenced them.
This removes them from Strings.resx and all localized .xlf files.

Co-authored-by: YuliiaKovalova <[email protected]>
Copilot AI changed the title Remove duplicate SDK environment variable log messages Remove duplicate SDK environment variable log messages and unused string resources Dec 11, 2025
Copilot AI requested a review from YuliiaKovalova December 11, 2025 10:13
@YuliiaKovalova YuliiaKovalova marked this pull request as ready for review December 11, 2025 16:39
Copilot AI review requested due to automatic review settings December 11, 2025 16:39
@baronfel
Copy link
Member

This removes the logging entirely, right? How do we know if/how the SdkResolvers had any impact on the overall evaluation - does the viewer still show them as Properties in the eval (I'd expect so)?

Copy link
Contributor

Copilot AI left a comment

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 removes non-actionable log messages about SDK environment variable operations that were cluttering structured log viewers. The changes eliminate three LogComment calls from AddSdkResolvedEnvironmentVariable() and clean up the associated unused string resources from all localization files.

  • Removed logging of SDK environment variable setting operations (already set as env var, already set by another SDK, and successful set)
  • Cleaned up three unused string resources from Strings.resx and all 13 localized .xlf files

Reviewed changes

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

Show a summary per file
File Description
src/Build/Instance/ProjectInstance.cs Removed three LogComment calls from AddSdkResolvedEnvironmentVariable() method
src/Build/Resources/Strings.resx Removed three unused string resource definitions
src/Build/Resources/xlf/Strings.cs.xlf Removed Czech translations for the three unused string resources
src/Build/Resources/xlf/Strings.de.xlf Removed German translations for the three unused string resources
src/Build/Resources/xlf/Strings.es.xlf Removed Spanish translations for the three unused string resources
src/Build/Resources/xlf/Strings.fr.xlf Removed French translations for the three unused string resources
src/Build/Resources/xlf/Strings.it.xlf Removed Italian translations for the three unused string resources
src/Build/Resources/xlf/Strings.ja.xlf Removed Japanese translations for the three unused string resources
src/Build/Resources/xlf/Strings.ko.xlf Removed Korean translations for the three unused string resources
src/Build/Resources/xlf/Strings.pl.xlf Removed Polish translations for the three unused string resources
src/Build/Resources/xlf/Strings.pt-BR.xlf Removed Brazilian Portuguese translations for the three unused string resources
src/Build/Resources/xlf/Strings.ru.xlf Removed Russian translations for the three unused string resources
src/Build/Resources/xlf/Strings.tr.xlf Removed Turkish translations for the three unused string resources
src/Build/Resources/xlf/Strings.zh-Hans.xlf Removed Simplified Chinese translations for the three unused string resources
src/Build/Resources/xlf/Strings.zh-Hant.xlf Removed Traditional Chinese translations for the three unused string resources

The changes are clean and well-executed. The functionality of tracking and setting SDK environment variables remains intact—only the logging has been removed. All string resources have been properly cleaned up from the main resource file and all 13 localization files consistently. No issues were found during the review.

@YuliiaKovalova
Copy link
Member

This removes the logging entirely, right? How do we know if/how the SdkResolvers had any impact on the overall evaluation - does the viewer still show them as Properties in the eval (I'd expect so)?

this pr removes only sdk-resolution related messages, the defined property remains here
{977DDD06-0AFE-4DFF-A20E-88583125FAC6}

Copy link
Member

@rainersigwald rainersigwald left a comment

Choose a reason for hiding this comment

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

I think I might favor keeping these messages only if the values differ, instead of dropping them entirely.

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.

Duplicated messages from SDK/environment resolution

4 participants