Skip to content

DotNetParser

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/libs/parser-core/src/parsers/backend/dotnet.parser.ts

.NET Parser implementation using Roslyn bridge

Implements: IParser

Methods

MethodSignatureReturns
initializeinitialize(_config: ParserConfig)Promise<void>
canParsecanParse(filePath: string)boolean
parseFileparseFile(filePath: string, content: string)Promise<ParseResult>
parseFilesparseFiles(files: ParseFileInput[])Promise<ParseResult[]>
parseProjectparseProject(rootDir: string)Promise<ParseResult>
destroydestroy()Promise<void>

Properties

PropertyType
nameany
versionany
supportedPatternsany

Where it refuses work

  • DotNetParser stops the work with Error when !this.roslynBridgePath — “Roslyn bridge path not initialized”.
  • DotNetParser stops the work with an early return when /\.sln$/.test(filePath).
  • DotNetParser stops the work with an early return when /\.csproj$/.test(filePath) || /\.vbproj$/.test(filePath).
  • DotNetParser stops the work with an early return when /appsettings.*\.json$/.test(filePath).
  • DotNetParser stops the work with an early return when /web\.config$/.test(filePath) || /app\.config$/.test(filePath).
  • DotNetParser stops the work with an early return when !result || !result.entities?.length.

When something fails

  • DotNetParser handles failure in 8 places: it logs it and continues in 5, turns it into a return value in 2, and discards it silently in 1. A failure discarded silently leaves no trace for whoever debugs this later.

Was this page helpful?

Download as PDF