Forum: Multi-Language Add-In for Visual Studio

ASP.NET / ASPX: "Unexpected duplicate node name for HTML cache"

Hi Phil

Looked through your log-file to find out why scanning is giving me a hard time in aspx files. I'm not sure I found my issue, but I found another one + a solution.

Please look at this code snippet:
https://gist.github.com/anonymous/cda2ce18befd57a74f8a9ccea522e043

The Error I'm getting is something like:
11:21:48.280858: Unexpected duplicate node name for HTML cache Test.aspx.Literal1.Text

And basically the error occurs because of the usage of "GridView" (could have been ListView or other similar controls). Basically I would recommend you reconsider your "cache naming".

As is, it would try to insert 3 items into the cache:

  1. Test.aspx.Literal1.Text
  2. Test.aspx.Literal1.Text
  3. Test.aspx.Literal1.Text


3 items with the same name, giving duplicate name error.

ASPX Control ClientID
This is actually a situation handled by ASPX already. Every control has a "ClientID" (as well as ID). "ClientID" will kind of contain the ParentID's, but not in all parent IDs. It depends if the control is having it's own scope or not - not sure how this is determined, when I look at PlaceHolder, this does not have it's own scope, but GridView does.

In my example it could be 3 ID's like

  1. ctl00_ctl00_Literal1
  2. ctl00_ctl00_GridView1_ctl02_Literal1
  3. ctl00_ctl00_GridView1_ctl03_Literal1


Suggestion
If you are not able to use "ClientID" (or prefer not to), you could consider some way to find out if a ParentID defines a new scope or not, so e.g. GridView name becomes part of your name like:

  1. Test.aspx.Literal1.Text
  2. Test.aspx.GridView1.Literal1.Text
  3. Test.aspx.GridView2.Literal1.Text


Not sure how to do this. There might be an Attribute (PersistenceModeAttribute (PersistenceMode enum) on GridViewColumns?) in relation to the GridView that could tell this, maybe it's the ITemplate type or similar..

This could explain some issue I've had in the past (since auto-generated ID's can cause some nasty issues).

I've made a mistake in my ClientID example. It would be something like (assuming we have 2 rows in each grid view):

  1. ctl00_ctl00_Literal1
  2. ctl00_ctl00_GridView1_ctl02_Literal1
  3. ctl00_ctl00_GridView1_ctl03_Literal1
  4. ctl00_ctl00_GridView2_ctl02_Literal1
  5. ctl00_ctl00_GridView2_ctl03_Literal1

Along the same lines. Can you explain what I should look for to correct errors like:

11:31:47.952267: Duplicate resource name ML_0000.Title detected for resource file C:\Data\EF\Repo\Projects\EuroForm.JetAdvice.Web.UI\Admin\App_LocalResources\Users.aspx.ko.resx
11:31:47.952267: Duplicate resource name ML_0002.Text detected for resource file C:\Data\EF\Repo\Projects\EuroForm.JetAdvice.Web.UI\Admin\App_LocalResources\Users.aspx.ko.resx
11:31:47.952267: Duplicate resource name ML_0003.Text detected for resource file C:\Data\EF\Repo\Projects\EuroForm.JetAdvice.Web.UI\Admin\App_LocalResources\Users.aspx.ko.resx

The original "duplicate node name for HTML cache" I have around 50 instances in my log file.
Above error "Duplicate resource name" I have around 1.000 instances in my log file.


Germany

I will look into this problem in the next day or two.

The HTML cache does not add much functionality anyway, so I might even be able to remove it completely.

Phil


Thanks, looking forward to get an update biggrin