Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop INCORRECT_TYPE_PARAMETER_NUMBER error by Resharper 8.2.1

I'm getting this error from Resharper when I add abstract generic class in

<configuration>
    <system.web.webPages.razor>
        <pages pageBaseType="LegalAudit.Web.WebViewPageBase">
   ...

And the class:

public abstract class WebViewPageBase<TModel> : WebViewPage<TModel>
{
    // ...
}

It reappears from time to time after making "Ignore this error" in the error list. How to get rid of it totally?

(There is a linked question at here but it is not connected to resharper.)

Thanks!

like image 587
Artyom Avatar asked Jul 24 '14 11:07

Artyom


2 Answers

Making another non generic class solved the error:

public abstract class WebViewPageBase<TModel> : WebViewPage<TModel>
{
    // ...
}

public abstract class WebViewPageBase : WebViewPageBase<object>
{

}
like image 183
Artyom Avatar answered Nov 13 '22 07:11

Artyom


When I add the following to the web.config, the error goes away, as expected. Reshaper, correctly, wants you to specify a specific implementation of WebViewPageBase:

  <system.web.webPages.razor>
    <pages pageBaseType="MvcApplication1.WebViewPageBase`1[[TModel]]">
    </pages>
  </system.web.webPages.razor>

And

namespace MvcApplication1
{
    using System.Web.Mvc;

    public abstract class WebViewPageBase<TModel> : WebViewPage<TModel>
    {

    }
}
like image 27
jessehouwing Avatar answered Nov 13 '22 07:11

jessehouwing