Add obsolete compatibility shims for moved Microsoft.Extensions.Logging internal types#127194
Add obsolete compatibility shims for moved Microsoft.Extensions.Logging internal types#127194
Conversation
…ractions.Internal namespace Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/5c5fb4d4-ec9e-4d85-a918-813e8b551daf Co-authored-by: ericstj <8918108+ericstj@users.noreply.github.com>
…or TypeNameHelper, FormattedLogValues, LogValuesFormatter, and NullScope Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/85535733-d8cc-4425-a106-63e3ccf52b70 Co-authored-by: ericstj <8918108+ericstj@users.noreply.github.com>
… location conventions Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/85535733-d8cc-4425-a106-63e3ccf52b70 Co-authored-by: ericstj <8918108+ericstj@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/0590d250-7011-4a2b-822c-8e0a47df5fcd Co-authored-by: ericstj <8918108+ericstj@users.noreply.github.com>
…forwards from Microsoft.Extensions.Logging Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/6df4e960-8c24-49ae-99ed-239b9771dc2d Co-authored-by: ericstj <8918108+ericstj@users.noreply.github.com>
|
Tagging subscribers to this area: @dotnet/area-extensions-logging |
There was a problem hiding this comment.
Pull request overview
This PR restores source/binary compatibility for older consumers by reintroducing several previously-available *.Internal-namespace types in Microsoft.Extensions.Logging.Abstractions as [Obsolete(error: true)] + [EditorBrowsable(Never)] shims.
Changes:
- Added obsolete shim types for
NullScopeandTypeNameHelperunderMicrosoft.Extensions.Logging.Abstractions.Internal. - Added obsolete shim wrapper types for
FormattedLogValuesandLogValuesFormatterunderMicrosoft.Extensions.Logging.Internal. - Updated the ref project to include
System.Collectionsand extended the reference surface accordingly.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/libraries/Microsoft.Extensions.Logging.Abstractions/src/TypeNameHelperObsolete.cs | Adds obsolete TypeNameHelper shim forwarding to Microsoft.Extensions.Internal.TypeNameHelper. |
| src/libraries/Microsoft.Extensions.Logging.Abstractions/src/NullScopeObsolete.cs | Adds obsolete NullScope shim type in *.Abstractions.Internal. |
| src/libraries/Microsoft.Extensions.Logging.Abstractions/src/LogValuesFormatterObsolete.cs | Adds obsolete wrapper for Microsoft.Extensions.Logging.LogValuesFormatter. |
| src/libraries/Microsoft.Extensions.Logging.Abstractions/src/FormattedLogValuesObsolete.cs | Adds obsolete wrapper for Microsoft.Extensions.Logging.FormattedLogValues. |
| src/libraries/Microsoft.Extensions.Logging.Abstractions/ref/Microsoft.Extensions.Logging.Abstractions.csproj | Adds System.Collections ref dependency for the updated reference surface. |
| src/libraries/Microsoft.Extensions.Logging.Abstractions/ref/Microsoft.Extensions.Logging.Abstractions.cs | Updates reference API surface to include the new obsolete types. |
This comment has been minimized.
This comment has been minimized.
6734d8e to
06cd5ec
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds [Obsolete(error: true)] + [EditorBrowsable(Never)] compatibility shims in Microsoft.Extensions.Logging.Abstractions to restore source/binary compatibility for previously-available *.Internal types.
Changes:
- Added obsolete shim types for
NullScope,TypeNameHelper,FormattedLogValues, andLogValuesFormatter. - Updated the reference assembly surface (
ref/*.cs) to include the shims. - Updated the ref-project to reference
System.Collections(needed by the new ref surface).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/libraries/Microsoft.Extensions.Logging.Abstractions/src/TypeNameHelperObsolete.cs | Adds obsolete shim forwarding to Microsoft.Extensions.Internal.TypeNameHelper. |
| src/libraries/Microsoft.Extensions.Logging.Abstractions/src/NullScopeObsolete.cs | Adds obsolete shim for prior Abstractions.Internal.NullScope. |
| src/libraries/Microsoft.Extensions.Logging.Abstractions/src/FormattedLogValuesObsolete.cs | Adds obsolete shim wrapping internal Microsoft.Extensions.Logging.FormattedLogValues. |
| src/libraries/Microsoft.Extensions.Logging.Abstractions/src/LogValuesFormatterObsolete.cs | Adds obsolete shim wrapping internal Microsoft.Extensions.Logging.LogValuesFormatter. |
| src/libraries/Microsoft.Extensions.Logging.Abstractions/ref/Microsoft.Extensions.Logging.Abstractions.csproj | Adds System.Collections ref dependency for the new reference API types. |
| src/libraries/Microsoft.Extensions.Logging.Abstractions/ref/Microsoft.Extensions.Logging.Abstractions.cs | Adds the shim types to the reference surface. |
tarekgh
left a comment
There was a problem hiding this comment.
I left a few minor comments, LGTM otherwise.
It will be good if we can add some tests to cover the new exposed APIs if possible, for the sake of the code coverage.
Co-authored-by: Eric StJohn <ericstj@microsoft.com>
There was a problem hiding this comment.
Pull request overview
Adds [Obsolete(error: true)] + [EditorBrowsable(Never)] compatibility shims in Microsoft.Extensions.Logging.Abstractions to restore binary/source compatibility for several historically-public “*.Internal” logging types that were moved, addressing TypeLoadException scenarios reported in #126995.
Changes:
- Introduces obsolete shim types for
NullScope,TypeNameHelper,FormattedLogValues, andLogValuesFormatterin their legacy namespaces. - Updates the reference assembly (
ref/) to include the restored public (obsolete) API surface. - Adds a missing
System.Collectionsref dependency needed by the updated reference assembly surface.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/libraries/Microsoft.Extensions.Logging.Abstractions/src/TypeNameHelperObsolete.cs | Adds obsolete Microsoft.Extensions.Logging.Abstractions.Internal.TypeNameHelper shim forwarding to Microsoft.Extensions.Internal.TypeNameHelper. |
| src/libraries/Microsoft.Extensions.Logging.Abstractions/src/NullScopeObsolete.cs | Adds obsolete Microsoft.Extensions.Logging.Abstractions.Internal.NullScope shim for legacy type availability. |
| src/libraries/Microsoft.Extensions.Logging.Abstractions/src/LogValuesFormatterObsolete.cs | Adds obsolete Microsoft.Extensions.Logging.Internal.LogValuesFormatter shim that wraps the internal formatter implementation. |
| src/libraries/Microsoft.Extensions.Logging.Abstractions/src/FormattedLogValuesObsolete.cs | Adds obsolete Microsoft.Extensions.Logging.Internal.FormattedLogValues shim that wraps the internal formatting struct. |
| src/libraries/Microsoft.Extensions.Logging.Abstractions/ref/Microsoft.Extensions.Logging.Abstractions.csproj | Adds System.Collections ref ProjectReference required by newly exposed List<>/collection types in the ref surface. |
| src/libraries/Microsoft.Extensions.Logging.Abstractions/ref/Microsoft.Extensions.Logging.Abstractions.cs | Adds the obsolete shim types to the reference assembly surface to restore compile-time/type identity compatibility. |
🤖 Copilot Code Review — PR #127194Note This review was generated by Copilot using Claude Opus 4.6 (primary) with GPT-5.3-Codex and Extensions-reviewer cross-validation. This review covers the code at commit 058c150, after the "Apply suggestions from code review" commit that addressed findings from the prior automated review. Holistic AssessmentMotivation: Justified. Issue #126995 reports a real Approach: Correct. The PR follows the established Summary: Detailed Findings
|
Yes - I specifically removed overloads that weren't present when the type was made internal.
Discussed this with @bartonjs and he's good with it. |
|
/ba-g All test failures are known. The remaining failures are all build timeouts when waiting for helix. These cannot be known issued since they are indistinguishable from build hangs. |
Fixes #126995
Restores source and binary compatibility for types that were previously in
*.Internalnamespaces. Only[Obsolete(error: true)]+[EditorBrowsable(Never)]shims are added — no new non-obsolete public API surface.Description
New obsolete shims (all in
Microsoft.Extensions.Logging.Abstractionsassembly):Microsoft.Extensions.Logging.Abstractions.Internal.NullScopeMicrosoft.Extensions.Logging.NullScopeMicrosoft.Extensions.Logging.Abstractions.Internal.TypeNameHelperMicrosoft.Extensions.Internal.TypeNameHelperMicrosoft.Extensions.Logging.Internal.FormattedLogValuesFormattedLogValuesin same assemblyMicrosoft.Extensions.Logging.Internal.LogValuesFormatterLogValuesFormatterin same assemblyFile naming: shim files follow the
*Obsolete.csconvention (NullScopeObsolete.cs,TypeNameHelperObsolete.cs, etc.).This work is a continuation of #87480, bringing back some additional types scoped out of that first wave. We follow the same pattern as those.