Search

Bug in System.Web.UI.WebControls.DataKey by George Hartz (LP)

Active

1
0
Sign in
to vote
Type: Bug
ID: 775825
Opened: 1/4/2013 11:01:00 AM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
Simple bug -- System.Web.UI.WebControls.DataKey in System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a doesn't have Equals() implemented properly.

There's a Equals(DataKey) method, which does a correct equality check, but the Equals(object) isn't overridden, which results in a pure reference check depending on which Equals call is called at compile-time.

So if you have two DataKey objects, k1 and k2, where k2 is a clone of k1, k1.Equals(k2) will return true. However, if you put k1 into an untyped collection (for example, like an ArrayList), arrayList.Contains(k2) will return false because ArrayList is calling Equals(object)
Details (expand)

Visual Studio/Team Foundation Server/.NET Framework Tooling Version

.NET Framework 4.5

Steps to reproduce

1) Open the source to DataKey, notice Equals(object) isn't implemented.

Product Language

English

Operating System

Windows 8

Operating System Language

English

Actual results

Equals(object) and Equals(DataKey) return inconsistent answers

Expected results

Equals(object) and Equals(DataKey) return consistent answers if the parameter is a DataKey
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 2/18/2013 at 12:25 PM
Thank you for your report. We're tracking this issue internally for an appropriate future release.
Posted by Microsoft on 1/7/2013 at 12:32 AM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 1/4/2013 at 11:51 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.