List details about the namespaces, methods, dependencies, properties, fields, events, constructors, and call graphs from a C# .NET source file, assembly, or NuGet package (.nupkg).
Dosai [command] [options]
methods Retrieve details about the methods
--version Show version information
-?, -h, --help Show help and usage information
--path [path] (REQUIRED) The file or directory to inspect (supports .dll, .exe, .cs, .vb, .fs, .nupkg)
--o The output file location and name, default value when option not provided is 'dosai.json'
dotnet build ./Dosai- Run a command such as:
dotnet run --project ./Dosai/ methods --path ./Dosai/bin/x64/Debug/net9.0/Dosai.dlldotnet run --project ./Dosai/ methods --path ./Dosai/Dosai.csdotnet run --project ./Dosai/ methods --path ./MyPackage.1.0.0.nupkg
 
- Windows: 
dotnet publish -r win-x64 --self-contained - Linux: 
dotnet publish -r linux-x64 --self-contained 
- Windows: 
Dosai.exe methods --path ./Dosai/bin/x64/Debug/net8.0/Dosai.dll - Linux: 
Dosai methods --path ./Dosai/Dosai.cs 
dotnet test
Dosai uses the Microsoft.CodeAnalysis (Roslyn) API and .NET Reflection to extract metadata from source code and compiled assemblies. It provides a unified view of code structure and dependencies across different .NET compilation outputs.
┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   Source Code   │    │  .NET Assembly  │    │   .nupkg File   │
│   (.cs, .vb)    │    │  (.dll, .exe)   │    │                 │
└─────────┬───────┘    └─────────┬───────┘    └─────────┬───────┘
          │                      │                      │
          │                      │                      │ (Extract)
          ▼                      ▼                      ▼
    ┌─────────────┐      ┌─────────────┐        ┌─────────────┐
    │  Roslyn     │      │  Reflection │        │  Extracted  │
    │  Analysis   │      │  Analysis   │───────▶│  Directory  │
    │             │      │             │        │             │
    └──────┬──────┘      └──────┬──────┘        └──────┬──────┘
           │                    │                      │
           │                    │                      │
           └────────────────────┼──────────────────────┘
                                │
                                ▼
                        ┌─────────────────┐
                        │  Unified JSON   │
                        │   Output Model  │
                        │ (MethodsSlice)  │
                        └─────────────────┘
GetSourceMethods: Uses Roslyn'sSyntaxTree,SemanticModel, and symbol analysis (IMethodSymbol,INamespaceSymbol, etc.) to parse source files (.cs, .vb, .fs) and extract method signatures, dependencies (usingdirectives), property/field/event declarations, and call graph information.GetAssemblyMethods: Uses .NET Reflection (Assembly.LoadFrom,Type.GetMethods, etc.) to load compiled assemblies (.dll, .exe) and extract method metadata, including signatures, attributes, and inheritance details.GetAssemblyInformation: Uses Reflection andFileVersionInfoto gather metadata about assemblies such as version, location, dependencies, and target framework.GetMethodsFromNupkg: Extracts the .nupkg archive (ZIP format) to a temporary directory, filtering for relevant .NET assemblies and source files, then delegates analysis to the existingGetMethodslogic.
The output is a JSON object conforming to the MethodsSlice class structure, containing:
Dependencies: List of external namespaces/libraries used.Methods: List ofMethodobjects detailing signatures, locations, parameters, return types, etc.MethodCalls: List ofMethodCallsobjects representing invocations found in source code.Properties,Fields,Events,Constructors: Lists of corresponding member types found in source.CallGraph: List ofMethodCallEdgeobjects defining the call graph structure.AssemblyInformation: List ofAssemblyInfoobjects detailing the inspected assemblies.SourceAssemblyMapping: List ofSourceAssemblyMappingobjects linking source locations to assembly definitions.
.nupkg files are ZIP archives. GetMethodsFromNupkg performs the following steps:
- Creates a temporary directory.
 - Uses 
System.IO.Compression.ZipFile.OpenReadto read the .nupkg. - Enumerates entries, skipping metadata files (
.nuspec,package/, etc.). - Extracts files with relevant extensions (
.dll,.exe,.cs,.vb,.fs). - Calls the standard 
GetMethodson the temporary directory. - Cleans up the temporary directory after analysis.
 
See this document for integration ideas.
See Yara Usage docs
Apache-2.0