Description
I noticed today that ASPNetCore pulls in System.Drawing.Common. This struck me as odd because I wasn't sure why ASP.NET would need to deal with images. That seems like >1MB of unused code.
I did a bit of digging and found the following:
Microsoft.AspNetCore.DataProtection & Microsoft.Extensions.Configuration.Xml > System.Security.Cryptography.Xml > System.Security.Permissions > System.Windows.Extensions > System.Drawing.Common
Crypto.Xml references System.Security.Permissions for only the Evidence
type. It's exposed in it's public surface area. This type is useless in .NETCore and only used for source compat. This probably should have been omitted from the Crypto.Xml surface area, like we omitted all other uses of Evidence across the stack, however I bet Crypto.Xml was also thought to be legacy due to the spec/security issues with XML encryption. We could push this one type down (and EvidenceBase) to break the dependency between Crypto.Xml and System.Security.Permissions.
System.Security.Permissions references System.Windows.Extensions for only the XamlAccessLevel
type. We could push this one type down to break this dependency. Then Permissions could reference only the assembly lower in the stack.
System.Windows.Extensions references System.Drawing.Common because we pushed types down. We can't break this dependency without making a binary breaking change (old code compiled against System.Windows.Extensions needs to resolve the types which have been moved down).
So we have two options to break dependencies here that involve pushing down tiny types. We should consider doing this in 6.0 to reduce the size of ASPNETCore and pull System.Drawing.Common out of it (as well as S.S.P). We just need to decide where to put these types 🤔