Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify rule S4545: Add VB.NET specifics, Move C# specifics
- Loading branch information
1 parent
8a5ec88
commit 0c34ec6
Showing
5 changed files
with
75 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
The ``++DebuggerDisplayAttribute++`` is used to determine how an object is displayed in the debugger window. | ||
|
||
|
||
The ``++DebuggerDisplayAttribute++`` constructor takes a single argument: the string to be displayed in the value column for instances of the type. Any text within curly braces is evaluated as the name of a field, property, or method. | ||
|
||
|
||
Naming a non-existent field, property or method between curly braces will result in a CS0103 error in the debug window when debugging objects. Although there is no impact on the production code, providing a wrong value can lead to difficulties when debugging the application. | ||
|
||
|
||
This rule raises an issue when text specified between curly braces refers to members that don't exist in the current context. | ||
|
||
|
||
== Noncompliant Code Example | ||
|
||
[source,text] | ||
---- | ||
[DebuggerDisplay("Name: {Name}")] // Noncompliant - Name doesn't exist in this context | ||
public class Person | ||
{ | ||
public string FullName { get; private set; } | ||
} | ||
---- | ||
|
||
|
||
== Compliant Solution | ||
|
||
[source,text] | ||
---- | ||
[DebuggerDisplay("Name: {FullName}")] | ||
public class Person | ||
{ | ||
public string FullName { get; private set; } | ||
} | ||
---- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
include::../rule.adoc[] | ||
include::rule-except-see.adoc[] | ||
|
||
ifdef::env-github,rspecator-view[] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
The ``++DebuggerDisplayAttribute++`` is used to determine how an object is displayed in the debugger window. | ||
|
||
|
||
The ``++DebuggerDisplayAttribute++`` constructor takes a single argument: the string to be displayed in the value column for instances of the type. Any text within curly braces is evaluated as the name of a field, property, or method. | ||
|
||
|
||
Naming a non-existent field, property or method between curly braces will result in a BC30451 error in the debug window when debugging objects. Although there is no impact on the production code, providing a wrong value can lead to difficulties when debugging the application. | ||
|
||
|
||
This rule raises an issue when text specified between curly braces refers to members that don't exist in the current context. | ||
|
||
|
||
== Noncompliant Code Example | ||
|
||
[source,vbnet] | ||
---- | ||
<DebuggerDisplay("Name: {Name}")> ' Noncompliant - Name doesn't exist in this context | ||
Public Class Person | ||
Public Property FullName As String | ||
End Class | ||
---- | ||
|
||
|
||
== Compliant Solution | ||
|
||
[source,vbnet] | ||
---- | ||
<DebuggerDisplay("Name: {FullName}")> | ||
Public Class Person | ||
Public Property FullName As String | ||
End Class | ||
---- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
include::../rule.adoc[] | ||
include::rule-except-see.adoc[] | ||
|
||
ifdef::env-github,rspecator-view[] | ||
|
||
|