Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application freeze when declaring DP in class with generic #10

Open
RodgerLeblanc opened this issue Nov 8, 2018 · 2 comments
Open

Application freeze when declaring DP in class with generic #10

RodgerLeblanc opened this issue Nov 8, 2018 · 2 comments

Comments

@RodgerLeblanc
Copy link

RodgerLeblanc commented Nov 8, 2018

When declaring a DP using Bindables in a generic class, the application freezes.

namespace BindablesGeneric
{
    public class MyLabel : MyLabel<string>
    {
    }

    public class MyLabel<T> : Label
    {
        //This one hang the execution, need to force close Visual Studio

        [DependencyProperty]
        public object MyProperty { get; set; }



        //This one works

        //public static readonly DependencyProperty MyPropertyProperty =
        //    DependencyProperty.Register(nameof(MyProperty), typeof(object), typeof(MyLabel<T>), new PropertyMetadata(null));

        //public object MyProperty
        //{
        //    get { return (object)GetValue(MyPropertyProperty); }
        //    set { SetValue(MyPropertyProperty, value); }
        //}
    }
}
@RodgerLeblanc
Copy link
Author

BindablesGeneric.zip

@notanaverageman
Copy link
Owner

Thanks for reporting the issue. I have found the root cause. The generic type in Mono.Cecil does not contain the T argument while it is being written in IL. That causes an infinite loop in .NET reflection codes.

I am trying to find a way to include the T in IL. I haven't found the way how Mono.Cecil handles it. When I find it, I will fix the code and release a new package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants