-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Add switch for trim out ConfigurationManager support #83023
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
With this change you can shave 900Kb out of 25.8Mb from sample SqlClient app from here dotnet/SqlClient#1941 (comment) Other example is that usage of `System.Runtime.Caching.MemoryCache` as shown in https://learn.microsoft.com/en-us/dotnet/api/system.runtime.caching.memorycache Applying configuration switch reduce app size by 5.2Mb (from 7.8Mb to 2.6Mb) Most likely modern applications which are first to use NativeAOT would not need this functionality because they use other means for configuration, so would be great to have this disabled. Low drop in size in SqlClient coming from fact that there other large dependencies which keep Xml related code around.
|
Tagging subscribers to this area: @dotnet/area-system-configuration Issue DetailsWith this change you can shave 900Kb out of 25.8Mb from sample SqlClient app from here dotnet/SqlClient#1941 (comment) Other example is that usage of Applying configuration switch reduce app size by 5.2Mb (from 7.8Mb to 2.6Mb) Most likely modern applications which are first to use NativeAOT would not need this functionality because they use other means for configuration, so would be great to have this disabled. Low drop in size in SqlClient coming from fact that there other large dependencies which keep Xml related code around. Discovered as part of dotnet/SqlClient#1942
|
|
Tagging subscribers to 'linkable-framework': @eerhardt, @vitek-karas, @LakshanF, @sbomer, @joperezr Issue DetailsWith this change you can shave 900Kb out of 25.8Mb from sample SqlClient app from here dotnet/SqlClient#1941 (comment) Other example is that usage of Applying configuration switch reduce app size by 5.2Mb (from 7.8Mb to 2.6Mb) Most likely modern applications which are first to use NativeAOT would not need this functionality because they use other means for configuration, so would be great to have this disabled. Low drop in size in SqlClient coming from fact that there other large dependencies which keep Xml related code around. Discovered as part of dotnet/SqlClient#1942
|
|
I wonder if it would be better if we changed these "up stack" libraries to no longer use ConfigurationManager. Cutting it off inside ConfigurationManager is probably going to lead to "random" runtime errors when some untested path calls into ConfigurationManager, and it throws. |
|
Oops! I definitely go overboard with some changes. My idea was to always return null when call
Regarding your question. In specific case of SqlClient the libraries which require |
eerhardt
left a comment
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.
I think we should consider removing dependencies upstack on ConfigurationManager. It is a legacy component that we haven't been making investments in. See https://github.com/dotnet/runtime/blob/main/src/libraries/System.Configuration.ConfigurationManager/README.md
This library exists only to support migrating existing .NET Framework code that uses System.Configuration.
| <PropertyGroup> | ||
| <IsPartialFacadeAssembly Condition="$([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')) == '.NETFramework'">true</IsPartialFacadeAssembly> | ||
| <!-- ILLinker settings --> | ||
| <ILLinkDirectory>$(MSBuildThisFileDirectory)ILLink\</ILLinkDirectory> |
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.
You shouldn't need this. It is already set in
Line 10 in 340d1f2
| <ILLinkDirectory Condition="'$(ILLinkDirectory)' == ''">$(MSBuildProjectDirectory)\ILLink\</ILLinkDirectory> |
...s/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationManager.cs
Outdated
Show resolved
Hide resolved
…stem/Configuration/ConfigurationManager.cs Co-authored-by: Eric Erhardt <[email protected]>
I would like to remove |
|
@kant2002 see my comment in the SqlClient repo. tl;dr I think SqlClient needs to have a "slim" entry point for size-sensitive users, rather than introduce feature switches around ConfigurationManager (and other components). |
|
@kant2002 thanks for the PR but closing based on feedback
|
With this change you can shave 900Kb out of 25.8Mb from sample SqlClient app from here dotnet/SqlClient#1941 (comment)
Other example is that usage of
System.Runtime.Caching.MemoryCacheas shown in https://learn.microsoft.com/en-us/dotnet/api/system.runtime.caching.memorycacheApplying configuration switch reduce app size by 5.2Mb (from 7.8Mb to 2.6Mb)
Most likely modern applications which are first to use NativeAOT would not need this functionality because they use other means for configuration, so would be great to have this disabled.
Low drop in size in SqlClient coming from fact that there other large dependencies which keep Xml related code around.
Discovered as part of dotnet/SqlClient#1942