You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+25-3Lines changed: 25 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,26 +18,48 @@ Although IntelliSense in your IDE guides the available SDK decorators and their
18
18
19
19
### Technical Primer
20
20
21
-
When you upload your project's built assembly to the ODC Portal, it does not have access to the underlying code—the ODC Portal checks compliance with the rules by reflecting on assembly's metadata.
21
+
When you upload your project's built assembly to the ODC Portal, it does not have access to the underlying code—the ODC Portal checks compliance with the rules by reflecting on the assembly's metadata.
22
22
23
23
This component, built from scratch, implements the rules using the rich code analysis APIs of [Roslyn](https://github.com/dotnet/roslyn), the .NET compiler.
24
24
25
+
#### Analyzer phases
26
+
27
+
The analyzer operates in two distinct phases, registered through the Roslyn `AnalysisContext`:
28
+
29
+
1.**Symbol analysis phase** – Triggered by `RegisterSymbolAction`, this phase performs immediate syntax and semantic analysis on individual declarations as you type. For example, when you declare a method, the analyzer instantly checks if its name starts with an underscore and reports a violation if it does (`NameBeginsWithUnderscoresRule`). These diagnostics appear immediately in your IDE's Problems window.
30
+
31
+
2.**Compilation end phase** – Registered via `RegisterCompilationEndAction`, this phase runs after all symbols have been processed and the semantic model is complete. For example, it ensures exactly one `[OSInterface]` exists across your entire codebase by maintaining a `ConcurrentDictionary` of interface declarations and validating their uniqueness (`NoSingleInterfaceRule` or `ManyInterfacesRule`). These diagnostics may appear with a slight delay as they require complete semantic analysis.
32
+
25
33
## How to use
26
34
27
35
### Visual Studio 2022 (Enterprise, Pro and Community editions)
28
36
29
37
You can use the auto-updating extension from the Visual Studio Marketplace. Simply [install the extension from the Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=JonathanAlgar.CustomCodeAnalyzer).
30
38
31
-
If your project references the External Libraries SDK (`OutSystems.ExternalLibraries.SDK`), the extension should automatically start providing feedback on your code.
39
+
If your project references the External Libraries SDK (`OutSystems.ExternalLibraries.SDK`), the extension should automatically start providing feedback on your code.
40
+
41
+
To ensure real-time feedback for [compilation end phase](#analyzer-phases) rules (not just during builds), you need to configure your Visual Studio's background analysis:
42
+
43
+
1. Select **Tools** > **Options**.
44
+
1. From the left menu select **C#** > **Advanced**.
45
+
1. Set both **Run background code analysis** for and **Show compiler errors and warnings** to **Entire solution**.
46
+
1. Make sure the **Run code analysis in separate process box** is unchecked.
32
47
33
48
### Others
34
49
35
50
Add the [NuGet package](https://www.nuget.org/packages/CustomCode.Analyzer/) as a dev dependency to your ODC external libraries project:
36
51
37
-
```dotnet add package CustomCode.Analyzer```
52
+
dotnet add package CustomCode.Analyzer
38
53
39
54
If your project references the External Libraries SDK (`OutSystems.ExternalLibraries.SDK`), the package should automatically start providing feedback on your code.
40
55
56
+
#### Visual Studio Code
57
+
58
+
To ensure real-time feedback for [compilation end phase](#analyzer-phases) rules (not just during builds), you need to configure your Visual Studio Code's background analysis:
59
+
60
+
1. Open the command palette (_Ctrl+Shift+P_).
61
+
1. Search for "roslyn". Set the **Dotnet › Background Analysis: Analyzer Diagnostics Scope** to **fullSolution**.
62
+
41
63
> :bulb: Auto-updating extensions for Visual Studio Code and Rider are in the works.
@@ -203,7 +203,7 @@ public static class Categories
203
203
title:"Unsupported type mapping",
204
204
messageFormat:"{0} has an incompatible DataType assigned and cannot be converted",
205
205
category:Categories.Design,
206
-
defaultSeverity:DiagnosticSeverity.Warning,
206
+
defaultSeverity:DiagnosticSeverity.Error,
207
207
isEnabledByDefault:true,
208
208
description:"The DataType assigned to a property or field is incompatible with its corresponding .NET type. It can't be automatically converted to the specified OutSystems type..",
0 commit comments