AppSurface Search
API Reference

Support

Type

PublicApiSnapshot

Source

Creates deterministic text snapshots of public API declarations for checked-in contract review.

Method

Create

string[] Create(Assembly assembly)

Describes every visible type in assembly in ordinal order.

Parameters

  • assembly
    Assembly whose public and protected contract is inspected.

Returns

Deterministically ordered declaration lines.

Method

AssertMatches

void AssertMatches(Assembly assembly, string copiedBaselineName, string sourceRelativePath)

Asserts the generated snapshot matches its copied baseline, or updates the trusted source baseline.

Parameters

  • assembly
    Assembly whose contract is inspected.
  • copiedBaselineName
    Baseline copied into the test output directory.
  • sourceRelativePath
    Trusted repository-relative baseline path used only in explicit update mode.

Exceptions

  • IOException
    Thrown when a baseline cannot be read or written.
  • Xunit.Sdk.EqualException
    Thrown when the reviewed and generated snapshots differ.

Remarks

Set APPSURFACE_UPDATE_PUBLIC_API_BASELINES=1 only for an intentional reviewed API update.

Method

DescribeType

string[] DescribeType(Type type)

Describes one visible type declaration and its visible declared members.

Parameters

  • type
    Type to inspect.

Returns

The type declaration followed by ordinally sorted member declarations.