Class TypeDiscoveryDiagnostics

Namespace
Cratis.Types
Assembly
Cratis.Fundamentals.dll

Answers questions about what type discovery did and did not reach.

public static class TypeDiscoveryDiagnostics
Inheritance
TypeDiscoveryDiagnostics
Inherited Members

Remarks

Deliberately something a host asks rather than something start-up does. Comparing what was discovered against what could have been means consulting the dependency model, and doing that on every start-up would spend part of the cost the generated providers exist to avoid, to catch a case most applications never hit. Asked instead of assumed, the cost lands only on the caller that wants the answer - a health check, a start-up self-test, a spec - and there is no budget to argue about.

Methods

FindMissingContributors(ITypes)

Finds project-referenced libraries that contributed nothing to a type universe.

[UnconditionalSuppressMessage("SingleFile", "IL3002", Justification = "Diagnostic API, called on demand by a host that accepts the cost.")]
[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Diagnostic API, called on demand by a host that accepts the cost.")]
public static IEnumerable<string> FindMissingContributors(ITypes types)

Parameters

types ITypes

The ITypes to check.

Returns

IEnumerable<string>

The names of the libraries that contributed nothing, empty when every one of them did.

Remarks

A generated provider registers itself from a module initializer, which runs when the CLR loads its assembly. An assembly that has not been loaded by the time the universe is built therefore contributes nothing to it, and says nothing about having done so - the types it owns are simply absent. Every name returned here is an assembly the application references and the universe never saw.

This reads names from the dependency model and does not load anything, so a name can also come back for a library that legitimately contributes no types at all.