Bug Report T1225395
Visible to All Users

Implement IComparable - code provider does not respect the naming convention defined for parameters

created a year ago (modified a year ago)

Steps to Reproduce:

  1. Naming convention for parameters is defined as _PascalCase
  2. Start with the code:
Visual Basic
Imports System.ComponentModel Public Class Class3 Implements INotifyPropertyChanged Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged Protected Sub NotifyPropertyChanged(_PropertyName As String) RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(_PropertyName)) End Sub Private m_Prop1 As String Private m_Prop2 As GenericEventArgs(Of GenericResultFlags) Public Property Prop1 As String Get Return m_Prop1 End Get Set(_Value As String) If m_Prop1 Is _Value Then Return End If m_Prop1 = _Value NotifyPropertyChanged(NameOf(Prop1)) End Set End Property Public Property Prop2 As GenericEventArgs Get Return m_Prop2 End Get Set(_Value As GenericEventArgs) If m_Prop2 = _Value Then Return End If m_Prop2 = _Value NotifyPropertyChanged(NameOf(Prop2)) End Set End Property Public Sub New(ByVal _Prop1 As String, ByVal _Prop2 As GenericEventArgs) m_Prop1 = _Prop1 m_Prop2 = _Prop2 End Sub End Class
  1. Execute the "Implement IComparable" for Class3

Expected code:

Visual Basic
Public Function CompareTo(_Obj As Object) As Integer Implements IComparable.CompareTo If _Obj Is Nothing Then Return 1 End If Dim other As Class3 = TryCast(_Obj, Class3) If other Is Nothing Then Throw New ArgumentException(NameOf(_Obj) & " is not a " & NameOf(Class3)) End If Return CompareTo(other) End Function Public Function CompareTo(_Other As Class3) As Integer Implements IComparable(Of Class3).CompareTo If _Other Is Nothing Then Return 1 End If Return m_Prop1.CompareTo(_Other.m_Prop1) End Function

Current code:

Visual Basic
Public Function CompareTo(obj As Object) As Integer Implements IComparable.CompareTo If obj Is Nothing Then Return 1 End If Dim other As Class3 = TryCast(obj, Class3) If other Is Nothing Then Throw New ArgumentException(NameOf(obj) & " is not a " & NameOf(Class3)) End If Return CompareTo(other) End Function Public Function CompareTo(other As Class3) As Integer Implements IComparable(Of Class3).CompareTo If other Is Nothing Then Return 1 End If Return m_Prop1.CompareTo(other.m_Prop1) End Function

Answers approved by DevExpress Support

created a year ago

We have addressed the issue described in this ticket and will include a fix in our next maintenance update. Should you need to apply our fix prior to official release, you can request a hotfix here.

Important Notes:

  • Hotfixes may be unavailable for Early Access/Beta builds or updates set for release within a week.
  • .NET only: in the NuGet Package Manager, use your personal NuGet feed and check the "Include prerelease" option to view the hotfix package in the "Updates" tab.

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.