I don't know what is calling my Equals method, because when the breakpoint is hit there is no call stack (except the Equals itself and [External Code]).
I have a class UserComplete that has methods GetAll and Equals and some others including a constructor that accepts an array of objects. UserComplete Inherits from User. User class includes methods GetRows and Equals.
Equals is nothing special:
Public Overrides Function Equals(obj As Object) As Boolean
If Not MyBase.Equals(obj) Then
Return False
End If
Dim u As UserComplete = CType(obj, UserComplete)
Return Me.RoleIds.Equals(u.RoleIds)
End Function
And GetAll just converts the object()() from the database or cache to a list of UserComplete
Public Function GetAll() As IList(Of UserComplete)
Dim rows As Object()() = GetRows()
If IsNothing(rows) Then
Return Nothing
End If
Dim completeUsers As List(Of UserComplete) = (From u In rows Select New UserComplete(DirectCast(u, Object()))).ToList()
If IsNothing(completeUsers) OrElse Not completeUsers.Any() Then
Return Nothing
End If
Return completeUsers
End Function
I call GetAll from a service controller and actually get a response, no problem. Then after that is complete a breakpoint in Equals is hit, and obj is a List(Of Integers) with one value.
If you would expect this behavior, why? If not, can you explain why it might be occuring and how to fix it?