The csharp provider is an external provider used to analyze .NET and C# source code. Currently, the provider supports the referenced capability.
The csharp provider uses a gRPC interface to perform a semantic analysis of an application source code in the source-only mode. The provider parses the source code by using tree-sitter and uses stack graph for the analysis to find references to types, methods, classes, and fields. Based on the C# custom rule definition, the analyzer identifies violations in your code that you must resolve before the application migration.
referenced-
The
csharpprovider supportsreferencedcapability in rules to define fields such aspatternandlocationbased on which the provider searches the code for violations.
when:
csharp.referenced:
pattern: "<pattern>"
location: CLASSwhere:
pattern-
A regular expression pattern to match the required reference. For example,
HttpNotFound. namespace-
Specifies the namespace to search within. For example,
System.Web.Mvc.