Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Bug in LinkItem.Attributes ?

Vote:
 

We're having problems sometimes when we try to add an attribute to a LinkItem.Attributes. We have a LinkItemCollection that we're iterating through, for each LinkItem we're adding an attribute like this:

linkItem.Attributes.Remove("class");
			linkItem.Attributes.Add("class", "icon " + @Html.GetFileType(linkItem));

		    if (Html.GetFileType(linkItem).ToString().Equals("pdf"))
		    {
		        linkItem.Attributes.Remove("target");
                linkItem.Attributes.Add("target", "_blank");
		    }


For some reason, the line linkItem.Attributes.Add("target", "_blank") sometimes crashes. This happens very very rarely. I've seen it only a couple of times during a year or so. And it's always the second time we're adding an attribute the exception happens.

Anyone know why this can happen? Or how to prevent this from happening?

See stacktrace below.

#134510
Sep 15, 2015 13:49
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.