Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8026395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:28:26+00:00 2026-06-04T23:28:26+00:00

Error CA1822 : Microsoft.Performance : The ‘this’ parameter (or ‘Me’ in Visual Basic) of

  • 0

Error CA1822 : Microsoft.Performance : The ‘this’ parameter (or ‘Me’
in Visual Basic) of ‘SomeController.AnAction(string, string)’ is never
used. Mark the member as static (or Shared in Visual Basic) or use
‘this’/’Me’ in the method body or at least one property accessor, if
appropriate.

A static action yields 404 not found when requested via URL. The action is working as expected with code analysis turned off. What’s the point of this and what’s the appropriate remedy?

Note that the return type of the action is PartialViewResult, it doesn’t seem as though code analysis complains about this if the return type is ActionResult.

    [HttpPost]
    public PartialViewResult BlankEditorRow(string formId, Common.Entities.Common.ObjTypeEnum objType)
    {
        if (objType == Common.Entities.Common.ObjTypeEnum.Regular)
            return new AjaxPartialViewResult("_RowEditor", new ProcedureEntryEntity()) { UpdateValidationForFormId = formId };
        else
            return new AjaxPartialViewResult("_TemplateRowEditor", new ProcedureEntryEntity()) { UpdateValidationForFormId = formId };
    } 

Update: Looks like changing the return type to ActionResult resolves the error, and PartialViewResult is an ActionResult so it should work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T23:28:27+00:00Added an answer on June 4, 2026 at 11:28 pm

    I doubt that changing the return type without calling using any instance members really resolves the problem. I suspect that in order to change the return type, you changed the return statement to something which accessed an instance member.

    Now I don’t know whether the route handling in MVC will let you mark the method as static, but it’s worth investigating. Even though the warning is given in terms of performance, I would think of it in terms of intent and readability.

    Typically there are two reasons for a method or property to be an instance member (rather than static):

    • It needs to access another instance member, because the way it behaves depends on the state of the object
    • It needs to behave polymorphically based on the actual type of the instance it’s called on, so that the behaviour can be overridden

    If neither of these is the case, then the method can be made static which indicates that there’s no polymorphism expected and no instance state required. A static member effectively advertises that the only state it depends upon is the state of the type itself (and the parameters), and that it won’t behave polymorphically. Aside from anything else, that means you can test it without creating an instance at all, too.

    Of course, if MVC’s infrastructure requires it to be an instance method, then you should just suppress the warning, with a comment to indicate that fact.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Error 3 error C2059: syntax error : ')' c:\program files\microsoft visual studio 10.0\vc\include\string 758
ERROR: Microsoft JScript runtime error: Object doesn't support this property or method here is
Error : Error 1 bin\Debug\Daemon.exe.manifest;bin\Release\Daemon.exe.manifest is an invalid value for the InputManifest parameter of
Error context: Visual Studio 2010 Service Pack 1 ASP.NET MVC 3 Application IE9 with
Error 7 The type 'System.Web.Routing.RouteValueDictionary' exists in both 'c:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Web.dll' and 'c:\WINNT\assembly\GAC_MSIL\System.Web.Routing\3.5.0.0__31bf3856ad364e35\System.Web.Routing.dll' c:\Projects\VS\solutionfolder\projectfolder\Views\group\List.aspx
error C2065: 'exam1' : undeclared identifier // basic file operations #include <iostream> #include <fstream>
error: passing 'const QByteArray' as 'this' argument of 'QByteArray& QByteArray::append(const QByteArray&)' discards qualifiers [-fpermissive]
Error 3 Running transformation: System.ArgumentException: Format of the initialization string does not conform to
Error on the following GridView xml Multiple annotations found at this line: - error:
Error occurs on this line: xPoint is Int32 randomsize is int xPoint = pictureBox1.Width

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.