Type to search pages and rules.

Browse pages

.NET Packages

A .NET backend references only the LiteBus modules its code dispatches and reports .NET breaches in the editor and the build. This page states that module scope and the analyzer setup that reports each breach at the line that breaks it. The shared dependency rules live on Dependencies; this page holds only their .NET form.

Markdown3 conventions

Stack: dotnet Layer: workspace

Standards#

None.

Conventions#

Reference Only the LiteBus Module Required#

conventiondefaultguidance
litespec/backend/dotnet/packages#reference-only-the-litebus-module-required
Default

Reference the LiteBus command, query, or event module that the code actually uses.

ReplacementA project names the LiteBus modules each layer references in its project documentation.

Why

A unified bus package pulls contracts for commands, queries, and events into a layer that dispatches only some of them. Referencing only the module the code uses keeps each dispatch surface exact.

Checka reviewer answers

Reviewed forWhich project files reference a LiteBus module their code never dispatches? Look at each project file.

Marked guidance: a reviewer answers this question.

Run LiteSpec Analyzers in the Business Projects and Hosts#

conventiondefaultguidance
litespec/backend/dotnet/packages#run-litespec-analyzers-in-the-business-projects-and-hosts
Default

Reference LiteSpec.Analyzers at the manifest pin, with PrivateAssets="all", from the shared kernel and modules projects and each host project.

ReplacementA project names the projects its analyzer run covers in its project documentation.

Why

The analyzers report a breach of a .NET provision in the editor and the build, at the line that breaks it, with a link to the provision. Without them, a breach surfaces only in review, if at all. The package is a development dependency: it adds nothing to the built assemblies, so Domain stays package-free at run time. LS2016 reports a pipeline-owned collaborator in a handler constructor; its default list covers the LiteBus unit of work, idempotency store, and outbox, and a project adds its uniqueness claim service. Check .NET code with the analyzers sets it up, and Analyzer rules lists what each rule reports.

Example

XML
<ItemGroup>
  <PackageReference Include="LiteSpec.Analyzers" PrivateAssets="all" />
</ItemGroup>
Checka reviewer answers

Reviewed forWhich shared kernel, modules, or host project files miss LiteSpec.Analyzers at the manifest pin with PrivateAssets="all"? Look at each business and host project file.

Marked guidance: a reviewer answers this question.

Raise the LiteBus Handler Analyzers to Errors#

conventiondefaultguidance
litespec/backend/dotnet/packages#raise-the-litebus-handler-analyzers-to-errors
Default

A project using LiteBus sets LB1023 and LB1024 to error in .editorconfig and lists its outside-world client types in litebus.LB1024.forbidden_types.

ReplacementA project whose command handlers run on another mediator names the analyzers that report nested mediation and outside-world clients in its handlers.

Why

Both LiteBus rules are off by default. LB1023 reports nested mediation in a command handler and LB1024 reports an outside-world client in a command handler, so consequences leave through event handlers after the commit under litespec/backend/application#keep-command-handlers-to-load-call-and-stage. The client list replaces the defaults, so it names every port that leaves the process. The same file lists the project pipeline-owned collaborators under the key the Configuration section of the LS2016 rule page names, such as its uniqueness claim service.

Example

Text
dotnet_diagnostic.LB1023.severity = error
dotnet_diagnostic.LB1024.severity = error
litebus.LB1024.forbidden_types = Claimwick.Payouts.PayoutBankClient
litespec.LS2016.pipeline_owned_types = Claimwick.Spending.ExpenseKeyClaims
Checka reviewer answers

Reviewed forDoes .editorconfig set LB1023 and LB1024 to error and list litebus.LB1024.forbidden_types? Look at .editorconfig.

Marked guidance: a reviewer answers this question.