Skip to main content

Diagnostics

Every NetPrints diagnostic has a stable code: a prefix that names the part of NetPrints that reports it and a number that is never reused for another meaning. Severities are the defaults; a project can change an analyzer rule's severity in .editorconfig.

This page lists every code. The tests keep it in step with the sources: a code that is added or removed without a row here fails DiagnosticsGuideTests.

PrefixReported by
NPAThe authoring analyzers of node classes (shipped in the NetPrints.Core package)
NPCThe catalog generator and reader
NPDThe graph document reader
NPEThe editor
NPIThe repository's internal source generators (NetPrints' own source, not shipped)
NPKThe extension test kit's conformance checks (NetPrints.Extensibility.Testing)
NPSThe repository style analyzers (NetPrints' own source, not shipped)
NPTThe translator and the code generator
NPWThe project system (project evaluation and restore)
NPXThe extension loader
NPXEThe experimental extension APIs

NPA: authoring​

These rules check the node classes whose pins the convention generator declares ([NodeKind] and [NodeBase] classes with partial pin properties). They ship with the NetPrints.Core package and report as errors, except the rules marked otherwise below.

CodeSeverityCause
NPA001errorA pin property or its class is not partial, the property is not get-only, or [Pin] or [PinType] sits on a property that cannot take it. The fix makes the class and the property partial.
NPA002errorTwo pins with the same key in one collection, counting the pins of base classes.
NPA003errorA constructor does not call DeclarePins() exactly once, or adds pins to a declared collection before it.
NPA004errorA pin key is empty or contains ., / or ~.
NPA005errorA [NodeBase] class adds pins imperatively to a collection in which the convention declares pins (the offsets would be wrong).
NPA006errorA [DefaultValue] on a typed input data pin does not convert to the pin's type.
NPA007errorAn untyped data pin or an output type pin has no [PinType], or its member is missing or is not an ObservableValue<BaseType>.
NPA008errorA pin property name does not end in Pin and has no [Pin] attribute. The fix adds [Pin("Name")] with the current name as the key.
NPA009errorA partial pin property in a class with neither [NodeKind] nor [NodeBase]. The fix adds [NodeBase] to an abstract class or [NodeKind("TODO.kindId")] to a concrete one; replace the placeholder with the real kind id.
NPA010warningA declared pin key is in neither NodePins.Shipped.txt nor NodePins.Unshipped.txt. The fix records it in the unshipped file.
NPA011errorA shipped pin key is no longer declared; the message names the old key and, when a new key took its place, the new one. The fixes keep the shipped key with [Pin("old")], or remove it on purpose with a *REMOVED* line in the unshipped file.
NPA012infoA node kind declares pins, but the project has neither NodePins.Shipped.txt nor NodePins.Unshipped.txt, so no pin key is tracked. Add both files (empty is fine) to turn tracking on.
NPA020errorAn icon id given to a command, panel or template descriptor is a constant that does not match ^[a-z0-9]+(\.[a-zA-Z0-9]+)+$, or is a netprints.icon. id the icon registry (IconIds) does not know.
NPA021errorA gesture passed to CommandGesture.Parse or TryParse does not parse, or a single-key or Shift-only gesture (function keys excepted) is a default of a command in the Global scope.
NPA022errorA constant contribution Id does not match the id pattern ^[a-z0-9]+(\.[a-zA-Z0-9]+)+$, or, when the project sets the MSBuild property NetPrintsExtensionId (the NetPrints.Core package makes it compiler-visible), does not start with that id and a dot.
NPA023errorTwo commands in one project are built with the same constant id.
NPA024warningTwo commands in one project are built with the same menu id, group and order.
NPA040warningA resource key a [NodeKind] class implies (Node.<kind>.Title when the class overrides TitleIsFixed, Node.<kind>.Pin.<direction>.<collection>.<key>, as in NodePins.Shipped.txt) is missing from the neutral resx. The repository sets it to an error. A project without a resx among its AdditionalFiles is not checked.
NPA041errorA satellite resx has a key the neutral file lacks, or a {n} placeholder count that differs from the neutral text.
NPA042infoA Node.<kind>.* resx key of a [NodeKind] class in the project that no declaration uses.

The pin key files are AdditionalFiles of the project (NodePins.Shipped.txt and NodePins.Unshipped.txt), one <kind> <direction>.<exec|data|type>.<key> line per pin; a project without them is not tracked.

NPC: catalogs​

Catalog codes are also described in Catalogs.

CodeSeverityCause
NPC001errorA catalog request names an assembly that is not referenced.
NPC002errorUnknown profile id.
NPC003errorProfile file unreadable or invalid, or a catalog id or accessor name that is not valid.
NPC004warningAn annotation sits on a member or type that is not public; it is ignored.
NPC005warningA member was skipped because a type it uses comes from an assembly that is not available.
NPC006errorTwo catalogs with the same id, or the same accessor name, in one build.
NPC007warningAn annotated library is compiled without documentation comments, so its own catalog has no summaries.
NPC101errorThe catalog schemaVersion is not supported by this reader.
NPC102errorThe catalog file is malformed.
NPC103warningTwo loaded catalogs share an id; the later one is ignored.

NPD: graph documents​

Document issues are reported when a graph file is read; all but NPD008 leave the document loaded.

CodeSeverityCause
NPD001warningA node of unknown kind (a missing or untrusted extension) is preserved unchanged.
NPD002warningA connection was dropped: missing node, unknown pin key or incompatible pins.
NPD003warningA pin state was dropped because its pin key is unknown.
NPD004warningA layout entry was ignored: unknown graph key or node id.
NPD005warningUnknown NetPrintsProfile; the default profile was used.
NPD006warningA project extension is not trusted; its nodes are preserved but inactive.
NPD007warningA node or member id was duplicated in its scope; the later one got a fresh id.
NPD008errorA graph document could not be read at all: malformed JSON or XML, or an unsupported extension.
NPD009warningA node or member id did not match the id format; it was replaced by a fresh id.
NPD010warningA call-method node was stored as pure but its method returns no value; it loaded as impure.
NPD011warningA custom event argument name was not a valid C# identifier or was used twice; it was repaired.

NPE: editor​

CodeSeverityCause
NPE001errorThe project folder has graph files, but the project system loaded none.

NPI: internal generators​

These rules belong to the generators that compose the editor ([Singleton<T>], [SessionScoped<T>], [ScopeFactory]) and to the smart enum generator ([SmartEnum]). They check NetPrints' own source and are not shipped in any package; they report as errors.

CodeSeverityCause
NPI001errorA singleton takes a session-scoped service, directly or through its factory method.
NPI002errorA service attribute on a type that cannot be registered: abstract, an open generic, not implementing the service, or a Factory that is missing, not unique or returns another type. Also a [ScopeFactory] method whose return type is neither registered nor constructible.
NPI003errorA registered type has no accessible constructor, or several and none marked [ActivatorUtilitiesConstructor].
NPI004errorTwo registrations of one service in the same lifetime where another registered type takes a single instance of it.
NPI005errorA type registered for several services is disposable (the container would dispose the one instance once for each registration) or the registrations have different lifetimes.
NPI010errorA [SmartEnum] type is not a top-level abstract partial class.
NPI011errorA smart enum member is a property or a field that is not static readonly, or a static field initializer reads All before every member field is declared (All would be read half-built).

NPK: extension conformance checks​

The conformance suite of NetPrints.Extensibility.Testing reports these. A failed check names its code, the rule it enforces and the item that breaks it. They are test failures, not build diagnostics, and a check that cannot run (for example because the extension folder is not given) is skipped, not failed.

CodeSeverityCause
NPK001errorThe manifest cannot be read, or its netprintsApi is not a version the host implements.
NPK002errorThe extension folder does not hold the assembly the manifest names, or it holds a copy of a host assembly.
NPK003errorThe extension assembly references a NetPrints assembly that is not part of the extension contract, so the host cannot share it.
NPK004errorLoading the extension twice gives different registries: registration is not pure or not repeatable.
NPK005errorThe extension fails to load, or its contributions raise a registry issue.
NPK006errorA node kind of the extension is not written and read back to the same bytes.
NPK007errorThe C# generated for a node kind of the extension does not compile.
NPK008errorTranslating the same graph twice gives different text.
NPK009errorA settings section of the extension does not serialize its default, does not accept it as valid, does not read back unchanged or cannot export a JSON schema.
NPK010errorA host channel is closed when it is created, throws when it takes a subscriber, is not closed after it is disposed (or disposing it twice throws), does not complete Messages within 5 seconds of closing, or takes a message after it closed.
NPK011errorLoading the extension changes an environment variable or the current directory of the process, or what the extension contributes differs when a failing neighbour and a neighbour that claims the same project properties are loaded next to it.
NPK012errorDisposing the registry, with a session still open and more than once, throws or logs a disposal failure of something the extension contributed.
NPK013errorThe extension's service provider does not build or validate (a missing registration, a singleton that captures a scoped service), the extension registers a type it does not own or replaces a host export, or a scoped or transient service is still reachable after its session is disposed.
NPK015errorAn editor contribution id does not start with the extension id, a label has neither a default text nor a string resource, a gesture does not parse back to itself or has no modifier on a global command, or an icon id is not the extension id, a dot and a name that a view resource defines.
NPK016errorA .axaml view of the extension holds a colour literal outside a theme dictionary or a FontSize or FontFamily literal.
NPK017errorThe extension references a NetPrints type or member that the host does not have. Reported by netprints extension verify, not by the conformance suite; each missing member is listed with the extension type that references it.

NPS: repository style​

These rules check NetPrints' own source. They are not shipped in any package and are off unless a repository turns them on in .editorconfig; the severities are the ones this repository sets.

CodeSeverityCause
NPS001errorAn attribute list shares a line with its member or with another attribute list. The fix puts each on its own line.
NPS002errorNo blank line between adjacent members when either is a property, indexer, method, constructor, operator or event, any public member (consts and fields included), or a member with braces, a comment or attributes. Enum members and record parameters are out of scope. The fix inserts a blank line.
NPS003suggestionNon-public fields and consts on one line each, with no comment or attribute, are grouped without a blank line. A hint only; it never fails a build.

NPH: repository hygiene​

These rules check NetPrints' own source in src/ and tests/. They are not shipped in any package and are off unless a repository turns them on in .editorconfig; the severities are the ones this repository sets. Reviewed exceptions live in HygieneLedger.txt at the repository root, one row per site (CODE | path | detail); the ledger only shrinks.

CodeSeverityCause
NPH001errorThe null-forgiving operator (x!, null!, default!) at a site the ledger does not list. Model the null instead.
NPH002errorA type or delegate name that ends in VM or has VM before an upper-case letter (MVVM excepted). Use ViewModel.
NPH003errorA diagnostic or kind code literal (NPT, NPD, NPX, NPW, NPC, NPS, NPA, NPH, NPI, NPK, NPR, NPXE) outside its constants class, or a code constant declared outside a designated file or twice in one project.
NPH004errorA #pragma warning directive, a #nullable disable or restore, or a [SuppressMessage] the ledger does not list for its file, member and rule (ADR-0003); a listed one must carry an ADR-0003 justification.
NPH005errorConfigureAwait(false) in a file where .editorconfig sets VSTHRD111 to none (UI-bound code resumes on the UI thread).
NPH006errorA string literal, or an interpolated string with literal text, passed to a user-visible text sink (a dialog title or message, status-bar text). Put the text in the resx and fill its placeholders with TextFormat.Of. A command label, panel, dialog, tile or template text is a LocalizedText with a convention key and is not reported.

NPT: translation and code generation​

CodeSeverityCause
NPT000errorA translation failure that is not yet mapped to a more specific code.
NPT001errorAn impure node is used outside its own event entry's exec flow.
NPT002errorAn event and a method on the same class share a name.
NPT003errorA graph holds a node of an extension that is not loaded; its generated file is left as it was.
NPT004errorA method-local variable's name conflicts with a parameter, another local or a C# keyword.
NPT005errorA member emitter threw while emitting a member.
NPT006errorNo translator is registered for a node's runtime type.
NPT007errorA member emitter produced an invalid result.
NPT008errorA required input data pin is not set and has no connection.
NPT009errorA variable has the Const modifier, which cannot be emitted yet.

NPW: project system​

CodeSeverityCause
NPW001errorNo .NET SDK could be registered; the editor and the command line cannot evaluate projects.
NPW002warningRestoring the project out of process failed; loading continues with what was restored.
NPW003errorMSBuild evaluation of the project failed.
NPW004warningThe project multi-targets; the first target framework is used.
NPW005warningMSBuild reported a diagnostic while opening the project.
NPW006infoLangVersion is latest, latestMajor, preview or default; it resolved to the smaller of the framework's maximum and the newest version NetPrints knows. Pin <LangVersion> so the generated code does not change with the SDK.
NPW007infoLangVersion is newer than the target framework's default; it is kept.
NPW008infoLangVersion is unknown or newer than the newest version NetPrints knows; that version is used.
NPW009warningA reference of the project could not be read (not a managed assembly, or damaged or locked); the editor skips it and loads the other references.

NPX: extension loader​

Extension codes are also described in Extensions.

CodeSeverityCause
NPX001errorInvalid or missing manifest, or an assembly without exactly one usable extension type.
NPX002errorThe manifest asks for an incompatible netprintsApi version.
NPX003errorA dependency is missing, failed to load, or is part of a dependency cycle.
NPX004errorAnother extension with the same id was found first.
NPX005errorCreating the extension or its Register method threw.
NPX006warningA contribution was rejected because of a conflict or inconsistency; the extension stays loaded.
NPX007errorThe extension assembly is missing or could not be loaded.
NPX008errorThe host or a dependency provides an older version of an assembly than the extension, or a private library it ships, was built against.
NPX009warningTwo commands asked for the same gesture in overlapping scopes; the first registration keeps it.
NPX010warningA contribution names an id nothing registered; for an icon id, the editor draws the fallback glyph.
NPX011warningA contributed handler, provider or view model factory threw while the editor ran it; its result is skipped and the failure is logged once per provider and session.
NPX012infoA project's extension has the same id as one in the user extension directories; the project's copy serves the session and the message names both versions.
NPX013warningA contributed id (for now a node search provider's) does not start with the manifest id of the extension that contributed it; the contribution is dropped.
NPX014warningAn extension's settings section failed validation; the section uses its defaults for the session and the file keeps what you wrote.

NPXE: experimental APIs​

These are compiler errors on a use of an unstable extension API until the project opts in; see API stability.

CodeSeverityCause
NPXE0001errorThe host channel API is experimental.
NPXE0002errorThe extension settings API is experimental.
NPXE0003errorThe class and member emitter API is experimental.
NPXE0004errorThe catalog engine and profile API is experimental.