Przeglądaj źródła

Merge pull request #133 from VaclavElias/staging-diagnostics-preview

feat: Diagnostics folder added
Vaclav Elias 2 lat temu
rodzic
commit
d4c89da75d
5 zmienionych plików z 73 dodań i 4 usunięć
  1. 6 0
      en/diagnostics/index.md
  2. 54 0
      en/diagnostics/strd001.md
  3. 3 0
      en/diagnostics/toc.md
  4. 5 2
      en/docfx.json
  5. 5 2
      en/toc.yml

+ 6 - 0
en/diagnostics/index.md

@@ -0,0 +1,6 @@
+# Stride diagnostics
+
+Some C# compiler errors have corresponding topics that explain why the error is generated, and, in some cases, how to fix the error. Use one of the following steps to see whether help is available for a particular error message.
+
+> [!WARNING]
+> Note that diagnostic feature is experimental and may not work as expected.

+ 54 - 0
en/diagnostics/strd001.md

@@ -0,0 +1,54 @@
+# Diagnostics Warning STRD001
+
+The Property `Array` has an invalid Access Type for an Array, expected for Arrays is public/internal get, Accessor, Stride will..
+
+## 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/)

+ 3 - 0
en/diagnostics/toc.md

@@ -0,0 +1,3 @@
+# [Diagnostics](index.md)
+
+# [STRD001](strd001.md)

+ 5 - 2
en/docfx.json

@@ -64,7 +64,8 @@
         "tutorials/**/*.md": "Stride Tutorials",
         "manual/**/*.md": "Stride Manual",
         "ReleaseNotes/**/*.md": "Stride Release Notes",
-        "api/**/*.md": "Stride API"
+        "api/**/*.md": "Stride API",
+        "diagnostics/**/*.md": "Stride Diagnostics"
       }
     },
     "sitemap": {
@@ -82,7 +83,9 @@
           "ReleaseNotes/toc.yml",
           "ReleaseNotes/**/*.md",
           "manual/toc.yml",
-          "manual/**/*.md"
+          "manual/**/*.md",
+          "diagnostics/toc.yml",
+          "diagnostics/**/*.md"
         ]
       },
       {

+ 5 - 2
en/toc.yml

@@ -1,4 +1,4 @@
-- name: 📚 Manual
+- name: 📚 Manual
   href: manual/
   homepage: manual/index.md
 - name: 🎓 Tutorials
@@ -7,4 +7,7 @@
   href: ReleaseNotes/ReleaseNotes.md
 - name: 🔧 API
   href: api/
-  homepage: api/index.md
+  homepage: api/index.md
+- name: 🔍 Diagnostics
+  href: diagnostics/
+  homepage: diagnostics/index.md