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
messagestringThe message.
MissingTypeShapeException(string, Exception)
Initializes a new instance of the MissingTypeShapeException class.
public MissingTypeShapeException(string message, Exception innerException)
Parameters
MissingTypeShapeException(Type, ITypeShapeProvider)
Initializes a new instance of the MissingTypeShapeException class.
public MissingTypeShapeException(Type type, ITypeShapeProvider provider)
Parameters
typeTypeThe type that lacked a shape.
providerITypeShapeProviderThe provider that was consulted.
Properties
Provider
Gets the provider that was consulted, when known.
public ITypeShapeProvider? Provider { get; }
Property Value
UnshapedType
Gets the type that lacked a shape, when known.
public Type? UnshapedType { get; }