27

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?

Grace Note
  • 3,205
  • 4
  • 35
  • 55
jcolebrand
  • 15,889
  • 12
  • 75
  • 121
  • 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`). – patridge Apr 21 '10 at 16:35
  • 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. – KFalk Mar 14 '11 at 17:44
  • 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. – jcolebrand Apr 21 '10 at 15:30
  • 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 Apr 21 '10 at 16:39
  • 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 http://youtrack.jetbrains.net/issue/RSRP-173600 – jcolebrand Apr 21 '10 at 16:53
  • Also this bug http://youtrack.jetbrains.net/issue/RSRP-175833 – jcolebrand Apr 21 '10 at 17:02
  • 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. – patridge Apr 21 '10 at 17:31
  • 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#. – jcolebrand Apr 21 '10 at 20:13
  • 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? – patridge Apr 22 '10 at 22:10
  • I lose my intellisense either . Did you guys found a solution ? – Mostafa Jun 18 '10 at 22:45

7 Answers7

11

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

mbx
  • 6,292
  • 6
  • 58
  • 91
8

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

jcolebrand
  • 15,889
  • 12
  • 75
  • 121
4

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

Community
  • 1
  • 1
Chad Hedgcock
  • 11,125
  • 3
  • 36
  • 44
3

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.

curiousBoy
  • 6,334
  • 5
  • 48
  • 56
2

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.

LosDude
  • 43
  • 1
  • 6
1

Try delete your .vs folder (hidden folder). It will reset config and cache of your solution

**enter image description here**

Wolf
  • 6,361
  • 2
  • 28
  • 25
0

Suspend and and restarting Reshaper worked. Issue was resolved.