Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 24, 2025

Summary

Updated the logging for C# Dev Kit project loading to include project capabilities when available.

Changes Made

  • Added ProjectCapabilities field to WorkspaceProjectCreationInfo (backward compatible with default value)
  • Updated logging in WorkspaceProjectFactoryService to include capabilities
  • Added new resource string with capability placeholder
  • Updated all 13 localization (.xlf) files
  • Updated test to verify logging output with CapturingLoggerProvider
  • Renamed test to LogProjectLoadWithCapabilities to better reflect its purpose
  • Fixed IDE0055 formatting errors

Test Updates

The LogProjectLoadWithCapabilities test:

  • Uses a custom CapturingLoggerProvider to capture log messages
  • Verifies the log message includes "with capabilities: CSharp, Test, Managed" when capabilities are provided
  • Verifies the log message does NOT include "with capabilities:" when no capabilities are provided (backward compatibility)
  • Confirms both scenarios contain "loaded by C# Dev Kit"

Expected Log Output

With capabilities:

Project /path/to/Project.Tests.csproj loaded by C# Dev Kit with capabilities: CSharp, Test, Managed

Without capabilities (backward compatible):

Project /path/to/Project.csproj loaded by C# Dev Kit
Original prompt

Code exists in this repo to log when a project is loaded by C# Dev Kit. Lines look like this...

[C#] [serviceBroker/connect] [WorkspaceProjectFactoryService] Project /path/to/Project.Tests.csproj loaded by C# Dev Kit

Can you update the logging to report the capabilities on the project when it is loaded as well?


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Update logging to include project capabilities on load Add project capabilities to C# Dev Kit project loading logs Oct 24, 2025
Copilot finished work on behalf of peterwald October 24, 2025 14:53
Copilot AI requested a review from peterwald October 24, 2025 14:53
Copilot AI requested a review from peterwald October 24, 2025 17:28
Copilot finished work on behalf of peterwald October 24, 2025 17:28
Copilot AI requested a review from peterwald October 24, 2025 17:50
Copilot finished work on behalf of peterwald October 24, 2025 17:50
@peterwald peterwald marked this pull request as ready for review October 24, 2025 17:51
@peterwald peterwald requested a review from a team as a code owner October 24, 2025 17:51
[property: DataMember(Order = 2)] string? FilePath,
[property: DataMember(Order = 3)] IReadOnlyDictionary<string, string> BuildSystemProperties);
[property: DataMember(Order = 3)] IReadOnlyDictionary<string, string> BuildSystemProperties,
[property: DataMember(Order = 4)] ImmutableArray<string> ProjectCapabilities = default);
Copy link
Member

Choose a reason for hiding this comment

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

Is the expectation the project capabilities are going to be used for something else down the road, or is this only for logging?

Copy link
Member

Choose a reason for hiding this comment

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

(maybe my real question is "the PR description tells me what this does, it doesn't tell me why")

Copy link
Member

Choose a reason for hiding this comment

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

The Test Explorer uses project capabilities, so we wanted to have logging that shows what their values are when loaded.

Copy link
Member

@dibarbet dibarbet Oct 24, 2025

Choose a reason for hiding this comment

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

The Test Explorer uses project capabilities, so we wanted to have logging that shows what their values are when loaded.

How is the C# extension involved here though - we don't utilize project capabilities? Wouldn't it be more appropriate to log on the CDK or test explorer side where they are produced or consumed? Imagine if there was some bug where the capabilities got sent to us, but not to the test explorer.

Copy link
Member

Choose a reason for hiding this comment

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

That's a fair point. The Test Explorer already does log this info, but since our project query filters projects based on capability we don't know for sure what is happening when a test project doesn't get reported to us. The intent was to log this info further up the line to get more visibility. I saw this log entry in the logs, so that is what I targeted to add additional info. I guess we could target CDK instead.

Copy link
Member

Choose a reason for hiding this comment

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

I guess we could target CDK instead.

That would be my preference - similar to the test explorer we're just a consumer of whatever CDK sends us. Logging on the CDK side seems more beneficial as they are the producers of this information. Additionally - I am not sure if anything will get logged here if the project changes after creation - this just logs the initial load.

@peterwald
Copy link
Member

@copilot Fix the formatting issues reported in the following build errors.

❌src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/WorkspaceProjectFactoryServiceTests.cs(82,1): error IDE0055: Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055)
❌src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/WorkspaceProjectFactoryServiceTests.cs(97,1): error IDE0055: Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055)
❌src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/WorkspaceProjectFactoryServiceTests.cs(101,1): error IDE0055: Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055)

Copy link
Contributor Author

Copilot AI commented Oct 24, 2025

@copilot Fix the formatting issues reported in the following build errors.

...

Fixed in commit 63be8f5. Removed trailing whitespace from lines 82, 97, and 101.

Copilot finished work on behalf of peterwald October 24, 2025 20:37
@peterwald peterwald closed this Oct 27, 2025
@peterwald peterwald deleted the copilot/update-logging-project-capabilities branch October 27, 2025 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants