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

Tag helpers not working on virtual/override properties #5653

Open
stsrki opened this Issue Nov 27, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@stsrki

stsrki commented Nov 27, 2018

I have a base class for my ModalContent component.

public abstract class BaseModalContent : BaseComponent
{
    [Parameter]
    protected virtual bool IsCentered
    {
        get => isCentered;
        set
        {
            isCentered = value;

            ClassMapper.Dirty();
        }
    }

    [Parameter]
    protected virtual ModalSize Size
    {
        get => modalSize;
        set
        {
            modalSize = value;

            ClassMapper.Dirty();
        }
    }
}

Then in my BaseBootstrapModalContent I have

public abstract class BaseBootstrapModalContent : Base.BaseModalContent
{
    protected override bool IsCentered
    {
        get => base.IsCentered;
        set
        {
            DialogClassMapper.Dirty();

            base.IsCentered = value;
        }
    }

    protected override ModalSize Size
    {
        get => base.Size;
        set
        {
            DialogClassMapper.Dirty();

            base.Size = value;
        }
    }
}

But when I try to use this fields they are not suggested or recognized by the Razor.
image

I must say that the code is working as expected, it's just that the intellisense is not working.

@rynowak

This comment has been minimized.

Member

rynowak commented Nov 27, 2018

Thanks for the thorough report. This is definitely intended to work so tools so this is a bug.

@stsrki

This comment has been minimized.

stsrki commented Nov 27, 2018

Just to let you know that I have now tried using the above code on different place but this time by setting it directly, that is without a member field.

Not working!!
<ModalContent IsCentered="true">

Working!!
<ModalContent IsCentered="@isCentered">

And this time it raises an exception.

@aspnet-hello aspnet-hello transferred this issue from aspnet/Blazor Dec 17, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment