Skip to content

AdaLibrary

Sanam edited this page Sep 23, 2026 · 1 revision

public static class AdaLibrary

Information about the loaded native library, and one process wide setting.

Member Description
PinnedVersion const string. The upstream Ada release this package is built and tested against, 4.0.0 in 0.1.1.
NativeVersion The version the loaded native library reports
GetNativeVersionComponents() The same as (int Major, int Minor, int Revision)
MaxInputLength Largest input the parser accepts, in bytes. Get and set. Default 4294967295 (uint.MaxValue).

Checking the native library

If NativeVersion differs from PinnedVersion, the process loaded a different ada binary than the one in the package, for example one on the system library path.

if (AdaLibrary.NativeVersion != AdaLibrary.PinnedVersion)
    logger.LogWarning("Ada native {Native}, expected {Pinned}", AdaLibrary.NativeVersion, AdaLibrary.PinnedVersion);

Limiting input size

MaxInputLength is the main control against very large inputs. It is stored inside the native library, so it applies to the whole process, including any other library that uses Ada. Set it once at startup, never per request.

AdaLibrary.MaxInputLength = 64 * 1024;

Longer inputs then fail to parse: CanParse returns false and Parse throws.

Clone this wiki locally