Noesis/Managed

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

aienabled opened this issue · 0 comments

Hi guys,

as .NET BCL types by definition cannot contain NoesisGUI calls you can safely ignore them here:

private static void RegisterDependencyProperties(System.Type type)
{
if (typeof(DependencyObject).GetTypeInfo().IsAssignableFrom(type.GetTypeInfo()))
{
RunClassConstructor(type);
return;
}

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!