Fix logging source generator CS0234 error with FormattableString namespace#118691
Fix logging source generator CS0234 error with FormattableString namespace#118691stephentoub merged 2 commits intodotnet:mainfrom
Conversation
There was a problem hiding this comment.
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 |
src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/LoggerMessageGenerator.Emitter.cs
Show resolved
Hide resolved
|
Tagging subscribers to this area: @dotnet/area-extensions-logging |
|
@stephentoub I'll try to look at the related failures. |
|
CC @ericstj regarding last commit fixing the test build error. |
tarekgh
left a comment
There was a problem hiding this comment.
Thanks @stephentoub for helping with that!
jvanlangen
left a comment
There was a problem hiding this comment.
Why did you removed the async file reading?
Because those APIs don't exist on NET Framework where these tests now run. |
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.