CriteriaParserLimitException Class
An exception that is thrown when a criteria string exceeds a criteria parser limit.
Namespace: DevExpress.Data.Filtering.Exceptions
Assembly: DevExpress.Data.v26.1.dll
NuGet Package: DevExpress.Data
Declaration
Remarks
The criteria parser throws this exception when a criteria string exceeds one of the following limits:
- CriteriaOperator.MaxParseDepth - the maximum depth of a criteria tree.
- CriteriaOperator.MaxParseOperands - the maximum number of operands in a single group or list.
- CriteriaOperator.MaxParseTokens - the maximum number of lexical tokens in a criteria string.
Use the Kind property to identify the exceeded limit.
CriteriaParserLimitException derives from CriteriaParserException. Existing parser error handlers also handle limit violations.
Treat a criteria string that exceeds a limit as invalid input and reject it. Raise or disable parser limits to accept these strings only after you verify that your application can safely process larger input.
The following example rejects criteria strings that exceed parser limits:
using DevExpress.Data.Filtering;
using DevExpress.Data.Filtering.Exceptions;
try {
CriteriaOperator criteria = CriteriaOperator.Parse(userInput);
// Use the criteria.
}
catch(CriteriaParserLimitException e) {
// e.Kind returns CriteriaParserLimitKind.Depth, Operands, or Tokens.
// The input exceeds a limit. Reject it.
}
catch(CriteriaParserException) {
// The input is not a valid criteria string. Reject it.
}
For additional information, refer to the following help topic: Criteria String Parsing and Untrusted Input.