瀏覽代碼

feat: Diagnostics updated

Vaclav Elias 2 年之前
父節點
當前提交
c55f66af32
共有 6 個文件被更改,包括 226 次插入4 次删除
  1. 3 3
      en/diagnostics/strd001.md
  2. 54 0
      en/diagnostics/strd002.md
  3. 56 0
      en/diagnostics/strd003.md
  4. 54 0
      en/diagnostics/strd004.md
  5. 54 0
      en/diagnostics/strd007.md
  6. 5 1
      en/diagnostics/toc.md

+ 3 - 3
en/diagnostics/strd001.md

@@ -1,6 +1,6 @@
 # Diagnostics Warning STRD001
 # Diagnostics Warning STRD001
 
 
-The Property `Array` has an invalid Access Type for an Array, expected for Arrays is public/internal get, Accessor, Stride will..
+An Array must have a public/internal getter for Serialization.
 
 
 ## Example
 ## Example
 
 
@@ -50,5 +50,5 @@ The `break` statement cannot be reached because it occurs after the `return` sta
 
 
 ## See also
 ## See also
 
 
-[C# Compiler Options](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/)
-[C# Compiler Errors](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/)
+- [C# Compiler Options](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/)
+- [C# Compiler Errors](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/)

+ 54 - 0
en/diagnostics/strd002.md

@@ -0,0 +1,54 @@
+# Diagnostics Warning STRD002
+
+A collection must have a public/internal getter for Serialization.
+
+## Example
+
+The following example generates STRD001:
+
+```csharp
+// STRD001.cs
+// compile with: /W:2
+public class Program
+{
+    public static void Main()
+    {
+        goto lab1;
+        {
+            // The following statements cannot be reached:
+            int i = 9;   // STRD001
+            i++;
+        }
+    lab1:
+        {
+        }
+    }
+}
+
+```
+
+Another common example where this error is generated is as follows:
+
+```csharp
+public static class Class1
+{
+    public static string Method1()
+    {
+        string x = "a";
+        switch (x)
+        {
+            case "a":
+                return "a";
+                break;          // CS0162
+        }
+        return "";
+    }
+}
+```
+
+The `break` statement cannot be reached because it occurs after the `return` statement. The `return` statement ends the enclosing `case` branch.
+
+## See also
+
+- [C# Compiler Options](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/)
+- [C# Compiler Errors](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/)

+ 56 - 0
en/diagnostics/strd003.md

@@ -0,0 +1,56 @@
+# Diagnostics Warning STRD003
+
+- A property must have a public/internal getter.
+- A property must be set during instantiation, then no public setter would be valid.
+- Or it must have a public setter else.
+
+## Example
+
+The following example generates STRD001:
+
+```csharp
+// STRD001.cs
+// compile with: /W:2
+public class Program
+{
+    public static void Main()
+    {
+        goto lab1;
+        {
+            // The following statements cannot be reached:
+            int i = 9;   // STRD001
+            i++;
+        }
+    lab1:
+        {
+        }
+    }
+}
+
+```
+
+Another common example where this error is generated is as follows:
+
+```csharp
+public static class Class1
+{
+    public static string Method1()
+    {
+        string x = "a";
+        switch (x)
+        {
+            case "a":
+                return "a";
+                break;          // CS0162
+        }
+        return "";
+    }
+}
+```
+
+The `break` statement cannot be reached because it occurs after the `return` statement. The `return` statement ends the enclosing `case` branch.
+
+## See also
+
+- [C# Compiler Options](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/)
+- [C# Compiler Errors](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/)

+ 54 - 0
en/diagnostics/strd004.md

@@ -0,0 +1,54 @@
+# Diagnostics Warning STRD004
+
+For <see cref="System.Collections.Generic.Dictionary{TKey, TValue}"/> the only valid Keys are primitive Types. All complex types like custom structs, objects are not allowed.
+
+## Example
+
+The following example generates STRD001:
+
+```csharp
+// STRD001.cs
+// compile with: /W:2
+public class Program
+{
+    public static void Main()
+    {
+        goto lab1;
+        {
+            // The following statements cannot be reached:
+            int i = 9;   // STRD001
+            i++;
+        }
+    lab1:
+        {
+        }
+    }
+}
+
+```
+
+Another common example where this error is generated is as follows:
+
+```csharp
+public static class Class1
+{
+    public static string Method1()
+    {
+        string x = "a";
+        switch (x)
+        {
+            case "a":
+                return "a";
+                break;          // CS0162
+        }
+        return "";
+    }
+}
+```
+
+The `break` statement cannot be reached because it occurs after the `return` statement. The `return` statement ends the enclosing `case` branch.
+
+## See also
+
+- [C# Compiler Options](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/)
+- [C# Compiler Errors](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/)

+ 54 - 0
en/diagnostics/strd007.md

@@ -0,0 +1,54 @@
+# Diagnostics Warning STRD007
+
+It's invalid to DataMember a private property. Also its invalid to DataMember a property which has DataMemberIgnore.
+
+## Example
+
+The following example generates STRD001:
+
+```csharp
+// STRD001.cs
+// compile with: /W:2
+public class Program
+{
+    public static void Main()
+    {
+        goto lab1;
+        {
+            // The following statements cannot be reached:
+            int i = 9;   // STRD001
+            i++;
+        }
+    lab1:
+        {
+        }
+    }
+}
+
+```
+
+Another common example where this error is generated is as follows:
+
+```csharp
+public static class Class1
+{
+    public static string Method1()
+    {
+        string x = "a";
+        switch (x)
+        {
+            case "a":
+                return "a";
+                break;          // CS0162
+        }
+        return "";
+    }
+}
+```
+
+The `break` statement cannot be reached because it occurs after the `return` statement. The `return` statement ends the enclosing `case` branch.
+
+## See also
+
+- [C# Compiler Options](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/)
+- [C# Compiler Errors](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/)

+ 5 - 1
en/diagnostics/toc.md

@@ -1,3 +1,7 @@
 # [Diagnostics](index.md)
 # [Diagnostics](index.md)
 
 
-# [STRD001](strd001.md)
+# [STRD001](strd001.md)
+# [STRD002](strd002.md)
+# [STRD003](strd003.md)
+# [STRD004](strd004.md)
+# [STRD007](strd007.md)