Resharper在VB.NET缩进上发疯了

时间:2014-05-28 14:09:46

标签: .net vb.net visual-studio-2010 resharper indentation

我不能为我的生活弄清楚为什么ReSharper 8.2.1在对我的班级进行完整的代码清理时这样做。

之前:

''' <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

后:

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

发送重新格式化的乱码的位是第一类字段上的XML doc块, mReason。删除此文档块使重新格式化工作更加合理(尽管它删除了在Class行之后和字段声明之前的额外行。

我在Resharper和VS2010的各种缩进和格式选项上一直在蠢蠢欲动,而且我完全迷失了。任何人都知道为什么XML文档块会严重破坏重新格式化?

1 个答案:

答案 0 :(得分:0)

这是ReSharper 8.2.1-3中的一个已知问题:https://youtrack.jetbrains.com/issue/RSRP-423225

希望它能在ReSharper 9中修复。

单身&#39;在缩进换行符后的新行中(来自您的示例的Public Class ServiceFaultDetails),虽然不是很优雅,但对我来说是个窍门。