Table of Contents

Class IceFeature

Namespace
IceRpc.Features
Assembly
IceRpc.Ice.dll

Default implementation of IIceFeature.

public sealed class IceFeature : IIceFeature
Inheritance
IceFeature
Implements
Inherited Members

Constructors

IceFeature(IActivator?, IceEncodeOptions?, int, int, int, IIceProxy?, IIceFeature?)

Constructs an Ice feature.

public IceFeature(IActivator? activator = null, IceEncodeOptions? encodeOptions = null, int maxCollectionAllocation = -1, int maxDepth = -1, int maxPayloadSize = -1, IIceProxy? baseProxy = null, IIceFeature? defaultFeature = null)

Parameters

activator IActivator

The activator.

encodeOptions IceEncodeOptions

The encode options.

maxCollectionAllocation int

The maximum collection allocation. Use -1 to get the default value: 8 times maxPayloadSize if set, otherwise the value provided by defaultFeature.

maxDepth int

The maximum depth. Use -1 to get the default value.

maxPayloadSize int

The maximum size of an Ice-encoded payload, in bytes. Use -1 to get the default value.

baseProxy IIceProxy

The base proxy, used when decoding service addresses into proxies.

defaultFeature IIceFeature

A feature that provides default values for all parameters. null is equivalent to Default.

Exceptions

ArgumentOutOfRangeException

Thrown when maxCollectionAllocation is a negative value other than -1, when maxDepth is 0 or a negative value other than -1, when maxPayloadSize is MaxValue or a negative value other than -1, or when maxPayloadSize is greater than int.MaxValue / 8 (256 MB) while maxCollectionAllocation is -1.

Properties

Activator

Gets the activator to use when decoding Ice-encoded classes and exceptions.

public IActivator? Activator { get; }

Property Value

IActivator

The activator. When null, the decoding of a request or response payload uses the activator injected by the generated code.

BaseProxy

Gets the base proxy used when decoding a service address into a proxy.

public IIceProxy? BaseProxy { get; }

Property Value

IIceProxy

The base proxy. A decoded proxy inherits the invoker and encode options of the base proxy. When null, the proxy that sent the request serves as the base proxy for a proxy decoded from an incoming response, while a proxy decoded from an incoming request receives Instance as its invoker.

Default

Gets a IIceFeature with default values for all properties.

public static IIceFeature Default { get; }

Property Value

IIceFeature

EncodeOptions

Gets the options to use when encoding the payload of an outgoing response.

public IceEncodeOptions? EncodeOptions { get; }

Property Value

IceEncodeOptions

The Ice encode options. null is equivalent to Default.

MaxCollectionAllocation

Gets the maximum collection allocation when decoding a payload, in bytes.

public int MaxCollectionAllocation { get; }

Property Value

int

The maximum collection allocation.

Remarks

This value is a cumulative budget for the decoding of one payload, not a limit on the size of each collection: the decoder charges the estimated memory size of each string, sequence, and dictionary against this budget before decoding it, based on the size or element count found in the encoded data, and throws InvalidDataException when the charge exceeds the remaining budget. Implementations must return a value greater than or equal to 0.

MaxDepth

Gets the maximum depth when decoding a class recursively.

public int MaxDepth { get; }

Property Value

int

The maximum depth.

Remarks

Implementations must return a value greater than 0.

MaxPayloadSize

Gets the maximum size of an Ice-encoded payload, in bytes. An Ice-encoded payload corresponds to the encoded arguments of an operation, the encoded return values of an operation, or the encoded Ice exception carried by a response with status code ApplicationError.

public int MaxPayloadSize { get; }

Property Value

int

The maximum size of an Ice-encoded payload, in bytes.

Remarks

This limit applies only when decoding the payload of an incoming request or response: the decoding throws InvalidDataException when the payload size carried by the request or response exceeds this maximum, before decoding any byte of the payload. It does not restrict the size of the payloads encoded by the application. The payload size does not include the size of any header for this payload, such as the encapsulation header with the ice protocol. Implementations must return a value greater than or equal to 0 and less than MaxValue.