-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Fix logging source generator CS0234 error with FormattableString namespace #118691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 |
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. |
There was a problem hiding this 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!
There was a problem hiding this 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?
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.