Skip to content

MstatReader

Namespace: Dotsider.Core.Analysis

Assembly: Dotsider.Core.dll

Reads an ILC size report (.mstat), the file IlcGenerateMstatFile emits when publishing a Native AOT project. The report is itself a valid ECMA-335 assembly: its assembly version carries the format version, and its data is encoded as IL instruction streams in global methods named Methods, Types, Blobs, and (in newer formats) RvaFields, FrozenObjects, ManifestResources, and DeduplicatedMethods. Format 2.0+ also stores each entry’s dependency-graph node name in a custom .names PE section; those names equal the node labels in the DGML graphs IlcGenerateDgmlFile emits, which is how sizes join to dependency chains.

Malformed input never throws: unreadable files return null, and damage within an IL stream, including an impossible nested count, yields the entries parsed before the damage.

public static class MstatReader

ObjectMstatReader

Cheaply tests whether a stream looks like an ILC size report. The stream is left open. See String) for what the probe checks.

Parameters:

  • stream (Stream): A readable, seekable stream positioned at the start of the file.

Returns: Boolean

True when the content plausibly is an mstat; false otherwise.

public static bool Probe(Stream stream)

Cheaply tests whether a file looks like an ILC size report, without decoding any IL streams or node names: the PE must carry metadata, the assembly version must be a known format version with the writer’s unset Build/Revision sentinels, and <Module> must declare both the Methods and Types global methods — every format version emits both, and requiring the pair keeps an ordinary managed module that happens to define one such global method from being misclassified. A positive probe is a sniff, not a guarantee — follow it with String) for the decoded report. Never throws.

Parameters:

  • filePath (String): The path of the candidate file.

Returns: Boolean

True when the file plausibly is an mstat; false otherwise.

public static bool Probe(string filePath)

Reads an ILC size report from a stream. The stream is left open.

Parameters:

  • stream (Stream): A readable, seekable stream positioned at the start of the file.

Returns: MstatData

The decoded report, or null when the content is not an mstat.

public static MstatData? Read(Stream stream)

Reads an ILC size report from a file.

Parameters:

  • filePath (String): The path of the .mstat file.

Returns: MstatData

The decoded report, or null when the file is missing or is not an mstat.

public static MstatData? Read(string filePath)