Skip to main content
All docs
V26.1
  • CriteriaOperator.MaxParseTokens Property

    Specifies the maximum number of lexical tokens in a criteria string that the criteria parser accepts.

    Namespace: DevExpress.Data.Filtering

    Assembly: DevExpress.Data.v26.1.dll

    NuGet Package: DevExpress.Data

    Declaration

    public static int MaxParseTokens { get; set; }

    Property Value

    Type Description
    Int32

    The maximum number of lexical tokens in a criteria string. The default value is DefaultMaxParseTokens (262144). Zero or a negative value disables the limit.

    Remarks

    The MaxParseTokens property limits the number of lexical tokens (names, numbers, strings, operators, brackets, and commas) in a criteria string. For instance, the [A] = 1 string consists of 3 tokens.

    If a criteria string exceeds the limit, the parser throws a CriteriaParserLimitException. The CriteriaParserLimitException.Kind property returns CriteriaParserLimitKind.Tokens.

    The limit applies to the entire process. The parser reads the property value each time it parses a string. Set the property once at application startup, before the application parses criteria strings.

    The default value does not affect realistic filters. If your application accepts only short and simple filters, lower the limit.

    Warning

    Raise or disable this limit only after you verify that your application can safely process larger input. An extremely long criteria string from an untrusted source can cause a denial of service.

    using DevExpress.Data.Filtering;
    
    // Call at application startup.
    CriteriaOperator.MaxParseTokens = 10000;
    

    For additional information, refer to the following help topic: Criteria String Parsing and Untrusted Input.

    See Also