Table of Contents

Class MissingTypeShapeException

Namespace
Nerdbank.Json.AspNetCoreMvcFormatter
Assembly
Nerdbank.Json.AspNetCoreMvcFormatter.dll

The exception thrown when the configured ITypeShapeProvider does not contain a shape for a type that the MVC pipeline asked the Nerdbank.Json formatters to read or write.

public class MissingTypeShapeException : InvalidOperationException, ISerializable
Inheritance
MissingTypeShapeException
Implements
Inherited Members

Remarks

This almost always indicates a configuration mistake: the model type was not included in the source-generated ITypeShapeProvider. Annotate the type with [GenerateShape] or add it to a witness class via [GenerateShapeFor<T>], and register that provider with the formatters. The formatters throw loudly rather than silently binding null or falling through to another formatter, so misconfiguration is obvious.

Constructors

MissingTypeShapeException(string)

Initializes a new instance of the MissingTypeShapeException class.

public MissingTypeShapeException(string message)

Parameters

message string

The message.

MissingTypeShapeException(string, Exception)

Initializes a new instance of the MissingTypeShapeException class.

public MissingTypeShapeException(string message, Exception innerException)

Parameters

message string

The message.

innerException Exception

The inner exception.

MissingTypeShapeException(Type, ITypeShapeProvider)

Initializes a new instance of the MissingTypeShapeException class.

public MissingTypeShapeException(Type type, ITypeShapeProvider provider)

Parameters

type Type

The type that lacked a shape.

provider ITypeShapeProvider

The provider that was consulted.

Properties

Provider

Gets the provider that was consulted, when known.

public ITypeShapeProvider? Provider { get; }

Property Value

ITypeShapeProvider

UnshapedType

Gets the type that lacked a shape, when known.

public Type? UnshapedType { get; }

Property Value

Type