KirillOsenkov / PublicBugs

My personal bug tracker for products where it's not worth logging a bug in their tracker
MIT License
0 stars 0 forks source link

WPF slow checks in ValueTable.cs #30

Open KirillOsenkov opened 5 months ago

KirillOsenkov commented 5 months ago

https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/Data/ValueTable.cs#L39-L49

KirillOsenkov commented 5 months ago
        private static void TurnOffWpfExtensionAssemblies()
        {
            var windowsBase = typeof(DependencyObject).Assembly;
            var presentationFramework = typeof(FrameworkElement).Assembly;

            var assemblyHelper = windowsBase.GetType("MS.Internal.AssemblyHelper");
            Reflector.PatchMethodToNoOp(assemblyHelper, ".cctor", isCtor: true);
            Reflector.PatchMethodToNoOp(assemblyHelper, "ExtensionsForSystemDrawing");
            Reflector.PatchMethodToNoOp(assemblyHelper, "ExtensionsForSystemXmlLinq");
            Reflector.PatchMethodToNoOp(assemblyHelper, "ExtensionsForSystemData");
            Reflector.PatchMethodToNoOp(assemblyHelper, "ExtensionsForSystemCore");
            Reflector.PatchMethodToNoOp(assemblyHelper, "ExtensionsForSystemXml");
            Reflector.PatchMethodToNoOp(assemblyHelper, "OnLoaded");

            var dataBindEngine = presentationFramework.GetType("MS.Internal.Data.DataBindEngine");
            Reflector.PatchMethodToNoOp(dataBindEngine, "RegisterForCacheChanges");
        }