Skip to content

Conversation

stephentoub
Copy link
Member

@stephentoub stephentoub commented Aug 13, 2025

Fixes #118686.

This change fixes a regression introduced in the linked issue. It also enables the tests on .NET Framework, allowing us to catch similar issues in the future.

Copy link
Contributor

@Copilot 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 enables logging generator tests to run on .NET Framework by adding multi-targeting support and handling framework-specific differences. The change allows better test coverage across different target frameworks.

Key changes:

  • Adds .NET Framework support to the test project configuration
  • Updates test code to handle .NET Framework API differences
  • Fixes a namespace reference in the generator code

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
Microsoft.Extensions.Logging.Generators.targets Adds multi-targeting to include .NET Framework and includes required compatibility shim
LoggerMessageGeneratorEmitterTests.cs Updates async file operations and string splitting for .NET Framework compatibility, adds platform-specific baseline adjustments
LoggerMessageGenerator.Emitter.cs Corrects FormattableString namespace reference from CodeAnalysis to System

Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-extensions-logging
See info in area-owners.md if you want to be subscribed.

@tarekgh
Copy link
Member

tarekgh commented Aug 13, 2025

@stephentoub I'll try to look at the related failures.

@tarekgh
Copy link
Member

tarekgh commented Aug 13, 2025

CC @ericstj regarding last commit fixing the test build error.

Copy link
Member

@tarekgh tarekgh left a comment

Choose a reason for hiding this comment

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

Thanks @stephentoub for helping with that!

@stephentoub stephentoub merged commit 438a8e7 into dotnet:main Aug 14, 2025
152 of 155 checks passed
@stephentoub stephentoub deleted the loggingnetfx branch August 14, 2025 18:54
Copy link

@jvanlangen jvanlangen left a comment

Choose a reason for hiding this comment

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

Why did you removed the async file reading?

@stephentoub
Copy link
Member Author

Why did you removed the async file reading?

Because those APIs don't exist on NET Framework where these tests now run.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[10.0-preview.7] Cannot compile using logging source generator due to CS0234 errors

4 participants