Skip to content

Overriden property in a custom attribute crashes runtime #119490

@MichalStrehovsky

Description

@MichalStrehovsky

This crashes with internal CLR error.

using System;
using System.Reflection;

Console.WriteLine(typeof(Program).GetCustomAttribute<DerivedAttribute>().Prop);

[Derived(Prop = 123)]
partial class Program;

class BaseAttribute : Attribute
{
    public virtual object Prop { get; set; }
}

class DerivedAttribute : BaseAttribute
{
    public override Enum Prop { get => (Enum)base.Prop; }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions