Closed Trimatix closed 16 hours ago
Tagging subscribers to this area: @dotnet/area-system-configuration See info in area-owners.md if you want to be subscribed.
System.Configuration.ConfigurationManager design is incompatible with trimming. It is not possible to make it work well in trimmed applications.
You may want to consider switching to a configuration library that is compatible with trimming such as https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-8/runtime#configuration-binding-source-generator . (This is documented at https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/incompatibilities#reflection-based-serializers .)
System.Configuration.ConfigurationManager design is incompatible with trimming. It is not possible to make it work well in trimmed applications.
Closing;
There is some work in v10 on this: https://github.com/dotnet/runtime/pull/108464
Just FYI, the work in https://github.com/dotnet/runtime/pull/108464 is designed to provide better trim warnings when using ConfigurationManager - not to make it compatible with trimming.
understood, thanks all 👍
Hi there, this is a followup after #101423.
I've rooted ConfigurationManager as described using TrimmerRootAssembly, but dotnet publish says that ConfigurationManager does not specify a RootMode, so I've given
<TrimmerRootAssembly Include="System.Configuration.ConfigurationManager" RootMode="Library" />
.In this mode, I still get the
Unhandled exception. System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize
error from #101423.Please could you advise the correct rootmode to use for this package? I haven't been able to find the documentation for
RootMode
online as of yet.Many thanks in advance
(dotnet 8, linux-x64)