-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Description
System.Data.Common.dll contains the SqlXml type. This type uses reflection to access the internal CreateSqlReader method in System.Private.Xml.dll:
https://github.com/dotnet/corefx/blob/5bc2806f33090e78b38fafe4d5b46d5a0a4c1f08/src/System.Data.Common/src/System/Data/SQLTypes/SqlXml.cs#L134
To ensure that this internal method (which has no other consumers) isn't trimmed away, System.Private.Xml lists this method in its ILLinkTrim.xml file:
https://github.com/dotnet/corefx/blob/5bc2806f33090e78b38fafe4d5b46d5a0a4c1f08/src/System.Private.Xml/src/ILLinkTrim.xml#L3-L6
which means that even if SqlXml isn't used by an app, this method and everything it depends on can't be trimmed away. That ends up keeping alive ~300KB of code that's likely otherwise unused. We should address this somehow, e.g. https://github.com/dotnet/corefx/issues/41201 (though this is a case of the cross-assembly private reflection mentioned there).