12

Since we implemented globalization in our ASP.net website, we are getting some intellisense problems.

When the resource is added to an asp.net control, we receive errors. Even though the error is shown in visual studio, the application works!

For example, the following button

 <asp:Button runat="server" ID="BtnSave" Text="<%$ Resources:ResourceName, Save %>" OnClick="BtnSave_Click" />

Is not recognized in the code behind:

intellisense problem

The error is only shown when the code behind is open. But in the browser it works!

The same button without the resource reference works well:

 <asp:Button runat="server" ID="BtnSave" Text="Save" OnClick="BtnSave_Click" />

This is a custom SQL resource provider factory, added to the web.config:

 <globalization resourceProviderFactoryType="MyNamespace.SqlResourceProviderFactory" />

I tried deleting the cache and restarting the computer already.

Do you have any tips on how to find the issue?

Thanks in advance.

Schiavini
  • 2,869
  • 2
  • 23
  • 49

8 Answers8

6

I had this problem when I created a new VS2010 solution and dragged in an existing website. To solve it right click on the project and 'Convert to Web Application' which will create designer files and fix the intellisense problems.

AshRolls
  • 396
  • 5
  • 14
  • been looking for a solution all day yours worked perfectly thank you very much ! – math487 Mar 20 '15 at 18:32
  • Still works in Visual Studio 2012 during the year 2015. This resolution is still valid. –  May 12 '15 at 22:15
3

Had this a few times myself, but unreleated to globalization.

I always solved it by restarting VS (which it looks like you've tried) or checking the class names in the front end code and back and code are the same.

It sounds like a stupid thing, but if you copy a page, then the class name doesn't update so the bindings go a little skewiffy (that's a technical term).

May not help, but it's something to check.

Dark Hippo
  • 1,255
  • 2
  • 15
  • 35
1

Try clearing out your the temp compiled page cache, both the 32-bit and 64-bit respective directories (64-bit shown below):

%System Drive%:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files

That sometimes can do the trick

Josh E
  • 7,390
  • 2
  • 32
  • 44
  • "I tried deleting the cache and restarting the computer already." – Schiavini Jul 17 '12 at 06:43
  • there's also a temp ASP.NET files folder in the `Users/AppData` folder -- have you cleared that for both your user and for any IIS AppPool user accts? – Josh E Jul 18 '12 at 16:43
  • any reason for the downvote? If my answer is misleading or totally useless, it'd be good to know – Josh E Jul 22 '12 at 15:32
1

Are you able to try it with an implicit resource key reference to see if this helps rather than the explicit reference you're using?

http://msdn.microsoft.com/en-us/library/ms227427.aspx

Additionally have you tried deleting your "obj" folder and rebuilding - sometimes this works for me?

Luke Baughan
  • 4,658
  • 3
  • 31
  • 54
1

We had this problem when the contents of the .aspx page had been copied in bulk to a new one resulting in 2 .aspx files pointing to the same code behind

CodeFile="xxxxxxxx.aspx.cs"

It manifested itself in the same way, error thrown, stopped the build but comment it out, build and then comment it back in and the site and functionality ran fine.

David Bell
  • 86
  • 1
  • 7
1

Usually this can be fixed by a clean and rebuild.

If that doesn't work then try adding something to the markup or design view to force the designer file to be regenerated.

This can also occur when you rename your page files. Double check in the .aspx file that the "CodeBehind=" and "Inherits=" fields are correct:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebPagName.aspx.cs" Inherits="NameSpace.ClassName" %>

For example, if your webpage name is WebPage1 and your class name in the WebPage1.aspx.cs file is WebPage1 and your project is named Project1 then it might look like this:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebPage1.aspx.cs" Inherits="Project1.WebPage1" %>
Soenhay
  • 3,958
  • 5
  • 34
  • 60
0

Can you please do "clean solution" and delete temp folder of asp.net in c drive and let me know if this helps

NG.
  • 5,695
  • 2
  • 19
  • 30
0

There was a problem in our Resource Provider: It was compiling and working on the runtime, but crashing when running without the HTTP context (HttpContext.Current).

I would advise other people experiencing the same problem to check the classes used in their web.config file for such inconsistencies.

Schiavini
  • 2,869
  • 2
  • 23
  • 49