Noesis / Managed

NoesisGUI Managed SDK
Other
94 stars 14 forks source link

Optimization: don't attempt registering dependency properties for .NET BCL types #3

Closed aienabled closed 2 years ago

aienabled commented 3 years ago

Hi guys,

as .NET BCL types by definition cannot contain NoesisGUI calls you can safely ignore them here: https://github.com/Noesis/Managed/blob/c2ccfc45ca8a39b8d0d063cdcded1a7d0230678f/Src/Noesis/Core/Src/Core/Extend.cs#L1642-L1648

You can check it this way:

private static readonly Assembly BclAssembly = typeof(object).Assembly;

private static void RegisterDependencyProperties(System.Type type)
{
    if (ReferenceEquals(type.Assembly, BclAssembly))
    {    
        return;
    }

    if (typeof(DependencyObject).GetTypeInfo().IsAssignableFrom(type.GetTypeInfo()))
    {
        RunClassConstructor(type);
        return;
    }
    ...

Regards!