Repository navigation
Configuration Analyzers
Roslyn code analyzer that validates FxMap Expression syntax during compilation. Catch expression errors before runtime and prevent production failures.
Catch syntax errors during development, not in production
See errors highlighted in Visual Studio, VS Code, and Rider
Validation happens at build time with no performance impact
Add the analyzer package to your project:
dotnet add package FxMap.Analyzers<ItemGroup>
<ProjectReference Include="../path/to/FxMap.Analyzers/FxMap.Analyzers.csproj" />
</ItemGroup>Severity: ErrorCategory: Syntax
The analyzer validates six key aspects of FxMap expressions:
Balanced Delimiters
Ensures braces {} for projections and the parentheses () of function arguments, such as :where(condition), are properly matched
Valid: Orders:where(Status = 'Done') Invalid: Orders:where(Status = 'Done'
Property Navigation
Requires dots before projections and after filters and functions
Valid: Country.{Id} Invalid: Country{Id}
Function Validation
Checks function names against known FxMap functions
Valid: Name:upper Invalid: Name:invalid
Computed Expressions
Computed expressions in projections must include aliases
Valid: {FullName: (Name:upper)} Invalid: {(Name:upper)}
Removed Syntax (5.0)
Reports the indexer [...] and the filter Collection(condition), which were removed in 5.0, and names the function to use instead
Valid: Orders:where(Status = 'Done'):orderBy(Date):first Invalid: Orders(Status = 'Done')[0 asc Date]
Operators
Only allows valid operators: =, !=, >, <, >=, <=, contains, startswith, endswith
Valid: Status = 'Done' Invalid: Status == 'Done'
Country.Name
Simple property navigation
Country.{Id, Name}
Projection with dot notation
{Id, Name, Email}
Root projection
Orders:where(Status = 'Done').Items
Filter with navigation
Provinces:orderBy(Name):first.Name
Sort, pick the first item, then navigate
{Id, FullName: (Name:upper)}
Computed expression with alias
Country{Id, Name}
Missing dot before projectionRule: Property Navigation
Orders:where(Status = 'Done')Items
Missing dot after filterRule: Property Navigation
{Id, (Name:upper)}
Computed expression without aliasRule: Computed Expressions
Name:invalid
Unknown functionRule: Function Validation
Orders:where(Status == 'Done')
Invalid operator (use = not ==)Rule: Operators
Orders(Status = 'Done')
The filter was removed in 5.0: use :where(...)Rule: Removed Syntax
Orders[0 asc Date]
The indexer was removed in 5.0: use :orderBy(...) with :first, :offset or :limitRule: Removed Syntax
-
1
Analyzer runs during compilation as part of the Roslyn compilation pipeline
-
2
Finds your ProfileOf configurations and the expression strings passed to .For(), .Expression() and .Else()
-
3
Parses each expression using the full FxMap expression parser
-
4
Reports syntax errors with position information in your IDE
This is a syntax-only validator. The analyzer does NOT:
- Verify property names exist in your entities
- Validate navigation paths for your data model
- Check data types or type compatibility
- Validate semantic correctness
These checks occur at runtime when FxMap processes your expressions.
Source: https://fxmapper.net/docs/configuration/analyzers/ — the website is always the most up to date version.
Introduction
Getting Started
Configuration
- Service Registration
- Entities & Profiles
- Handlers
- Pipelines
- Strongly Typed IDs
- Error Handling
- Retry Policy
- Supervisor
- Telemetry
- Kestrel (HTTP/2)
- Analyzers
Expressions
- Overview
- Property Access
- Filters, Sorting & Paging
- Functions
- Aggregations
- Projections
- Coalesce & Ternary
- GroupBy
Data Providers
Transports
Integrations
Quality
AI Assistants
Migration
Release Notes