简体   繁体   中英

Resharper going crazy on VB.NET indentation

I cannot for the life of me figure out why ReSharper 8.2.1 is doing this on a full code cleanup to my class.

Before:

''' <summary>
''' Data contract to store details of a generic service fault
''' </summary>
''' <remarks></remarks>
Public Class ServiceFaultDetails

    ''' <summary>
    ''' Reason why this fault was raised.
    ''' </summary>
    ''' <remarks></remarks>
    <DataMember()> _
    Private mReason As String

    ''' <summary>
    ''' Overloaded constructor to initialise the reason and original exception message properties.
    ''' </summary>
    ''' <param name="reason">Reason why the fault was raised.</param>
    ''' <remarks></remarks>
    Public Sub New(ByVal reason As String)
        mReason = reason
    End Sub

    ''' <summary>
    ''' Accessor for the reason field.
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public ReadOnly Property Reason() As String
        Get
            Return mReason
        End Get
    End Property

End Class

After:

Public Class ServiceFaultDetails
''' <summary>
''' Reason why this fault was raised.
''' </summary>
''' <remarks></remarks>
                                <DataMember()>
    Private mReason As String

                                ''' <summary>
                                ''' Overloaded constructor to initialise the reason and original exception message properties.
                                ''' </summary>
                                ''' <param name="reason">Reason why the fault was raised.</param>
                                ''' <remarks></remarks>
                                Public Sub New(ByVal reason As String)
        mReason = reason
    End Sub

                                ''' <summary>
                                ''' Accessor for the reason field.
                                ''' </summary>
                                ''' <value></value>
                                ''' <returns></returns>
                                ''' <remarks></remarks>
                                Public ReadOnly Property Reason() As String
        Get
            Return mReason
        End Get
    End Property
End Class

The bit that's sending the reformatting haywire is the XML doc block on the first class field, mReason. Removing this document block makes the reformatting work much more sensibly (although it removes the extra line after the Class line, and before the field declaration.

I've been having a poke around at the various indentation and formatting options in Resharper and VS2010, and I'm utterly lost. Anyone have a clue why that XML doc block is breaking the reformatting so badly?

This is a known issue in ReSharper 8.2.1-3: https://youtrack.jetbrains.com/issue/RSRP-423225

Hopefully it will get fixed in ReSharper 9.

Putting single ' in new line right after indenting linebreak (Public Class ServiceFaultDetails from your example), while not very elegant, does the trick for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM