Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganizing active VB.NET document damages code #403

Closed
0ndrej opened this issue Feb 23, 2017 · 5 comments
Closed

Reorganizing active VB.NET document damages code #403

0ndrej opened this issue Feb 23, 2017 · 5 comments

Comments

@0ndrej
Copy link

0ndrej commented Feb 23, 2017

Environment

  • Visual Studio version: Visual Studio Community 2015 Update 3
  • CodeMaid version: 10.2
  • Code language: Visual Basic .NET

Description

Reorganizing VB.NET document where are properties with 2+ attributes (data annotations) damages code.

Steps to recreate

Create new VB.NET console application, add reference to System.ComponentModel.DataAnnotations and replace Module1.vb with code below. Then do CodeMaid/Reorganize Active Document.

Imports System.ComponentModel.DataAnnotations
Module Module1
  Sub Main()

  End Sub
  <Required(ErrorMessage:="Code can not be empty.")>
  <StringLength(25, ErrorMessage:="Code can not exceed 25 characters.")>
  Public Property Code As String
    Get
      Return _code
    End Get
    Set(value As String)
      _code = value
    End Set
  End Property
  Private _code As String
End Module

Current behavior

Attributes are separated from their class member (property).

Expected behavior

Attributes must move with their class member.

@codecadwallader
Copy link
Owner

Thanks for reporting the issue. A few questions:

  1. Does the behavior only happen when there are two attributes present? In other words does it work as expected with one attribute?
  2. When the issue occurs does one of the attributes move and one get left behind?
  3. Does the order of the attributes matter (i.e. if you reverse them, is the behavior the same)?

@0ndrej
Copy link
Author

0ndrej commented Feb 23, 2017

I tested it more and it happens with any number of attributes applied to class member. Attributes stay at bottom of source file and everything else is sorted as expected.

@codecadwallader
Copy link
Owner

Ok, thanks for confirming. That reminded me there is an existing issue #333 with some other notes. Lets close this one in favor of that.

@0ndrej
Copy link
Author

0ndrej commented Feb 23, 2017

By referencing contribution in issue #333 you mean that you will not fix it?

@codecadwallader
Copy link
Owner

Please read the whole thread for context on why contribution was mentioned. As an open source project contributions are extremely encouraged to expedite specific requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants