Why do I get an error 'Cannot resolve symbol <symbolname>' in ReSharper?

42,877

Solution 1

So no final resolution yet. According to tech-support this is a known issue and is being researched. Final resolution undetermined at this time. If you're experiencing a similar issue, just hang tight. URL: http://youtrack.jetbrains.net/issue/RSRP-178681

Solution 2

In Resharper you can disable inspection for that file with: Ctrl + Shift + Alt + 8.

Solution 3

Nothing worked for me until I followed this answer -- removing the related reference from the Project/References and then adding it again.

Solution 4

This worked in my case (Visual Studio 2015): Go to Menu and select Options. From the opened window, select ReSharper Ultimate (yours might be different edition) and click Suspend. That will basically suspend all the resharper features. Then click "Resume"

That should work. Otherwise, try to clean Resharper cache.

Solution 5

I just tried something odd and it worked. In your page directive, change the AutoEventWireup to false, SAVE the file, then change it back to true. It's some connection between the aspx file and the designer I think.

Share:
42,877
jcolebrand
Author by

jcolebrand

I'm now working for a group out of Plano, doing primarily front-end work for mobile and online banking for credit unions. Time for me to get involved in the local user groups! You probably want to gmail me if you need me directly. If I have to tell you what gmail address to guess at, you're not trying hard enough. Everything else can be found at http://jcolebrand.info

Updated on October 04, 2020

Comments

  • jcolebrand
    jcolebrand over 2 years

    Using VS2008 and R# 5 I'm running into an odd situation, where on an aspx page I keep getting

    Cannot resolve symbol 'symbolname'
    

    But the code compiles and runs fine. While having a fix for this would be great, I'm just trying to figure out if I'm losing my mind.

    The CodeFile directive and Inherits directives are fine. If I compile the app or just let devenv sit for a bit it'll go away, but as soon as I save the aspx [via ctrl+s] R# suddenly has trouble with the Inherits attribute and flips out on every method in the page (OnClick etc).

    // Anonymized of course but otherwise intact
    <%@ Page AutoEventWireup="true" CodeFile="TestPage.aspx.cs" Inherits="TestPage" Language="C#" MasterPageFile="~/MasterPage.master" Title="Test Page Title" %>
    

    This is mostly just a grievance, because since the code compiles it doesn't stop me from doing what I need.

    I would post a bug report to the JetBrains site but first I would like to know I'm not alone. It could be my machine. Maybe when I roll to VS2010 in a couple weeks this will go away?

    • jcolebrand
      jcolebrand about 13 years
      Hi Kirill, as I stated before, I didn't necessarily know if it might just be my configuration, so before I submit a test case, I wanted to see if anyone else had noticed it and just didn't think to mention it. Let me give it a week and if it's still doing this with no resolution or if anyone else posts to this, then I'll gladly submit a bug report. ~ I just hate to cause unnecessary bug reporting for an issue on my system, ya know? ~ I'll see if creating a new project will let me reproduce this behavior, and we can coordinate from there.
    • patridge
      patridge about 13 years
      I get the same issue in one of my VB.NET ASP.NET Forms (not MVC) applications. It appears to only happen in ASP.NET code-behind (ASPX or ASCX both) and I have only seen it so far on calls to extension methods. ReSharper both flags them as "cannot resolve" but also suggests I use the extension method as a static method instead: x.MyExtensionMethod(y) => MyExtensionMethod(x, y). I just figured it was an issue with the annoying way VB.NET does extension methods (modules and attributes instead of static classes with this).
    • jcolebrand
      jcolebrand about 13 years
      Bug report submitted with basic sample that is not completely indicative of true failure but demonstrates the error. (I don't have the time to filter down to exactly what's failing where or to build a huge project but I can cause the error condition to appear briefly)
    • jcolebrand
      jcolebrand about 13 years
      May also be related to this bug-post because we use a lot of our own controls and so they're registered in the web.config instead of each page youtrack.jetbrains.net/issue/RSRP-173600
    • jcolebrand
      jcolebrand about 13 years
    • patridge
      patridge about 13 years
      If those are related to your issue, my similar issue may be unrelated. The project of mine with that issue doesn't have any custom controls registered in web.config.
    • jcolebrand
      jcolebrand about 13 years
      Ok, but you get the same behavior, so mine may not be related to those. I'm not entirely sure what my problem is, so trying to find things that look related. Since I can push the error to occur in a fresh website project with nothing added, I don't think mine is necessarily related to those. Depends on what happens under the hood in R#.
    • patridge
      patridge about 13 years
      I found another side-issue that may be related to my issue, regardless of its relation to your issue. If an "Imports" statements only purpose is to provide scope for an extension method used in a code-behind class, it is deemed "not required by the code" and flagged for "safe" removal. I am guessing this is another side-effect of my those same extension methods not being resolved by R# but being fine with the compiler. What was the URL for the bug you filed for this?
    • Mostafa
      Mostafa about 13 years
      I lose my intellisense either . Did you guys found a solution ?
    • KFalk
      KFalk over 12 years
      Hi, thanks for the post. Is this strange behavior reproducible on a simple WebSite? Please try it and send me solution. Thanks in advance! You could contact me directly via email. I'll try to reproduce this.
  • dynamiclynk
    dynamiclynk almost 8 years
    I added a ReSharper exception for *.cshtml ReSharper > Options > Code Inspection - VS2015 RTM
  • Stephan Schielke
    Stephan Schielke over 6 years
    Tried that; Didn't help. Closed the solution and opened it again fixed the problem for me.