ASN.1/C# Compiler Limitations

Applies to: ASN.1/C# v5.3

When using the OSS ASN.1 compiler, consider the following limitations:

Line Size

The maximum number of bytes allowed on a single line of an ASN.1 input file is 4096.

Token Item Size

The maximum number of bytes allowed on an input item such as an identifier, type reference, value reference, module reference, bstring, cstring, or hstring is 1024.


To enable support for INTEGERs that have a maximum size of 4096 bytes, use the ASN1.HugeInteger or OSS.HUGE directive. In C#, the size of an INTEGER is 4 bytes.

Real Range Constraint

Although the ASN.1 compiler supports the syntax of open-ended, value range constraints on REAL types, the runtime libraries will not enforce open-ended, value range constraints (using "<") on REAL types. These are treated as if the "<" was not present in the schema. If an open-ended constraint must be enforced, use the EXCEPT clause.


Instead of:

A ::= REAL ( 0 <..MAX ) 
B ::= REAL ( 100 <..< 1000 )


A ::= REAL (( 0..MAX ) EXCEPT 0) 
B ::= REAL (( 100 <..< 1000 ) EXCEPT ( 100 | 1000 ))

Limitations to be removed in future releases

  • The -prefix compiler option is not supported.
  • The -relaySafe compiler option, which can preserve unknown extensions during re-encoding, is not supported.
  • Open types with a single type constraint cannot be automatically decoded. However, the component relation constraint is supported.
  • The following ASN.1 types are currently not supported by CPER: SET OF, GeneralString, and GraphicString. The compiler issues a warning when these types are encountered in the ASN.1 schema and the -cper or -cuper compiler options are used.
  • The ASN1.DeferDecoding directive is not supported with the EXTENDED-XER codec. When ASN1.DeferDecoding is used with the -exer compiler option, the compiler issues a warning.

This documentation applies to the OSS® ASN.1 Tools for C# release 5.3 and later.

Copyright © 2024 OSS Nokalva, Inc. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means electronic, mechanical, photocopying, recording or otherwise, without the prior permission of OSS Nokalva, Inc.
Every distributed copy of the OSS® ASN.1 Tools for C# is associated with a specific license and related unique license number. That license determines, among other things, what functions of the OSS ASN.1 Tools for C# are available to you.