ReSharper 2026.1 Help

コードインスペクション:'[BaseTypeRequired]' 属性で指定された型が別の型と競合する

このインスペクションは、属性型の [BaseTypeRequired] 宣言が互いに矛盾していることを報告します。 これは、属性が互換性のない 2 つの具象基底クラスを必要とする場合に発生します。 ターゲットクラスは両方から継承できないため、属性定義は内部的に矛盾しています。

解決策は、競合する [BaseTypeRequired] 宣言のいずれかを削除または変更して、属性の要件が一貫しているようにすることです。

using System; using JetBrains.Annotations; public class Bar { } public class Foo : Bar { } public class Foo2 : Bar { } [BaseTypeRequired(typeof(Foo2))] [BaseTypeRequired(typeof(Foo))] public class MyComponentAttribute : Attribute { }
using System; using JetBrains.Annotations; public class Bar { } public class Foo : Bar { } public class Foo2 : Bar { } [BaseTypeRequired(typeof(Foo))] public class MyComponentAttribute : Attribute { }
2026 年 6 月 12 日