Search code examples
c#resharperabstract-classmvc-editor-templatesasp.net-mvc-uihint

UIHint can not resolve template in abstract models


Assume an abstract model like this:

 public abstract class MyClass : BaseEntity
{
    [UIHint("File")]
    public long? DocumentFileId { get; set; }
}

The problem is Cannot resolve template 'File', while there is File.cshtml in View editor templates.

Message as shown in Visual Studio

The point is, if I don't define MyClass as an abstract class, error will be solved.

My question is, why editor template can not resolve in abstract classes, and how can I handle it?


Solution

  • This is a bug with ReSharper that was reported almost a year ago. Doesn't look like JetBrains are in a rush to fix it.

    However, it shouldn't interfere with your development other than being a nuisance.