You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[dotnet-sdk-11.0.100-preview.4.26214.103] GlobalToolsNETCore21Part02 execute "dotnet vstest" failed with error: System.TypeLoadException : Could not load type 'Microsoft.Extensions.Logging.Internal.FormattedLogValues'... #126995
When running "dotnet vstest DockerWatch.Test.dll" on latest build dotnet-sdk-11.0.100-preview.4.26214.103, there are three cases failed with error: System.TypeLoadException : Could not load type 'Microsoft.Extensions.Logging.Internal.FormattedLogValues' from assembly 'Microsoft.Extensions.Logging.Abstractions, Version=11.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
Reproduction Steps
Environment Configuration:
Copy GlobalToolsNETCore21Part02Test56 from \appcompatsrv\BugRepro_Share\2940187 to local machine.
Install dotnet-sdk-11.0.100-preview.4.26214.103.
Modify DockerWatch.Test.runtimeconfig.json to enable the app to run on dotnet-sdk-11.0.100-preview.4.26214.103.
"framework": {
"name": "Microsoft.NETCore.App",
"version": "11.0.0-preview.4.26214.103"
}
Error Message:
System.TypeLoadException : Could not load type 'Microsoft.Extensions.Logging.Internal.FormattedLogValues' from assembly 'Microsoft.Extensions.Logging.Abstractions, Version=11.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
Stack Trace:
at DockerWatch.Test.LoggerAdapterTest.LogInformation_ShouldLogAnInformationMessage() in C:\Users\v-joyzhu\Desktop\unit test\docker-watch-master\docker-watch-master\test\DockerWatch.Test\LoggerAdapterTest.cs:line 17
at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
Runtime Environment:
OS Name: Windows
OS Version: 10.0.26200
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\11.0.100-preview.4.26214.103\
What’s happening is that the tests bring in Microsoft.Extensions.Logging.Abstractions, Version=2.1.1.0, and DockerWatch.Test references that assembly. After moving Microsoft.Extensions.Logging.Abstractions assemly (and its dependencies) to NetCoreApp in .NET 11, the tests began loading the version that ships with the .NET 11 SDK instead.
The issue is that in version 2.1.1.0, certain types, such as NullScope are defined under the Microsoft.Extensions.Logging.Abstractions.Internal namespace. In newer versions, these types were moved to Microsoft.Extensions.Logging. Similarly, FormattedLogValues was previously under Microsoft.Extensions.Logging.Internal but now resides in Microsoft.Extensions.Logging.
DockerWatch.Test directly references these older internal types, for example:
This results in a type's load exception, since those internal namespaces no longer exist in the newer assemblies.
@ericstj might have guidance here, as I’m unsure whether DockerWatch.Test should be rebuilt against the updated .NET 11 dependencies, or if there’s a way to force loading the older Microsoft.Extensions.Logging.Abstractions, Version=2.1.1.0 instead of the version included with .NET 11.
I was aware of these breaks in Extensions from a few years back when we tried to improve the compatibility from 2.x era extensions to latest. At the time we didn't add back these pub-ternals because we didn't see a lot of usage in other packages except our own packages - which folks could update. Now that we force this in .NET 11 without necessarily a developer around to rebuild (roll forward) we can look at a better fix. I have a change in progress that will add back the removed types. https://github.com/dotnet/runtime/tree/copilot%2Fadd-null-scope-type-back
@tarekgh@ericstj When running with dotnet-sdk-11.0.100-preview.4.26224.122, the System.TypeLoadException is no longer reproducible; however, a new Moq.MockException has surfaced. We’ve filed a new bug for this issue. Could you please help take a look?
Activity
dotnet-policy-service commentedon Apr 16, 2026
Tagging subscribers to this area: @dotnet/area-extensions-logging
See info in area-owners.md if you want to be subscribed.
tarekgh commentedon Apr 16, 2026
dotnet/dotnet#5206
tarekgh commentedon Apr 16, 2026
What’s happening is that the tests bring in
Microsoft.Extensions.Logging.Abstractions, Version=2.1.1.0, andDockerWatch.Testreferences that assembly. After movingMicrosoft.Extensions.Logging.Abstractionsassemly (and its dependencies) toNetCoreAppin .NET 11, the tests began loading the version that ships with the .NET 11 SDK instead.The issue is that in version
2.1.1.0, certain types, such asNullScopeare defined under theMicrosoft.Extensions.Logging.Abstractions.Internalnamespace. In newer versions, these types were moved toMicrosoft.Extensions.Logging. Similarly,FormattedLogValueswas previously underMicrosoft.Extensions.Logging.Internalbut now resides inMicrosoft.Extensions.Logging.DockerWatch.Testdirectly references these older internal types, for example:This results in a type's load exception, since those internal namespaces no longer exist in the newer assemblies.
@ericstj might have guidance here, as I’m unsure whether
DockerWatch.Testshould be rebuilt against the updated.NET 11dependencies, or if there’s a way to force loading the olderMicrosoft.Extensions.Logging.Abstractions, Version=2.1.1.0instead of the version included with .NET 11.ericstj commentedon Apr 20, 2026
I was aware of these breaks in Extensions from a few years back when we tried to improve the compatibility from 2.x era extensions to latest. At the time we didn't add back these pub-ternals because we didn't see a lot of usage in other packages except our own packages - which folks could update. Now that we force this in .NET 11 without necessarily a developer around to rebuild (roll forward) we can look at a better fix. I have a change in progress that will add back the removed types. https://github.com/dotnet/runtime/tree/copilot%2Fadd-null-scope-type-back
Add obsolete compatibility shims for moved Microsoft.Extensions.Loggi…
WeiweiCaiAcpt commentedon Apr 28, 2026
@tarekgh @ericstj When running with dotnet-sdk-11.0.100-preview.4.26224.122, the System.TypeLoadException is no longer reproducible; however, a new Moq.MockException has surfaced. We’ve filed a new bug for this issue. Could you please help take a look?
Add obsolete compatibility shims for moved Microsoft.Extensions.Loggi…