System 4.0.0.0 System.TimeoutException System.MonoTODO

The presence of a exception generally indicates one of the following conditions:

The regular expression engine is backtracking excessively as it attempts to match the input text to the regular expression pattern.

The time-out interval has been set too low, especially given high machine load.

The way in which an exception handler handles an exception depends on the cause of the exception:

If the time-out results from excessive backtracking, your exception handler should abandon the attempt to match the input and inform the user that a time-out has occurred in the regular expression pattern-matching method. If possible, information about the regular expression pattern, which is available from the property, and the input that caused excessive backtracking, which is available from the property, should be logged so that the issue can be investigated and the regular expression pattern modified. Time-outs due to excessive backtracking are always reproducible.

If the time-out results from setting the time-out threshold too low, you can increase the time-out interval and retry the matching operation. The current time-out interval is available from the property. When a exception is thrown, the regular expression engine maintains its state so that any future invocations return the same result, as if the exception did not occur. The recommended pattern is to wait for a brief, random time interval after the exception is thrown before calling the matching method again. This can be repeated several times. However, the number of repetitions should be small in case the time-out is caused by excessive backtracking.

The example in the next section illustrates both techniques for handling a .

The exception that is thrown when the execution time of a regular expression pattern-matching method exceeds its time-out interval.

- Constructor
  4.0.0.0

  This is the default constructor of the class. This constructor initializes the property of the new instance to a system-supplied message that describes the error. This message is localized for the current system culture.

  Initializes a new instance of the class with a system-supplied message.

- Constructor
  4.0.0.0

  The string is assigned to the property. The string should be localized for the current culture.

  Initializes a new instance of the class with the specified message string.

  A string that describes the exception.
- Constructor
  4.0.0.0

  This constructor is not called directly by your code to instantiate the object. Instead, it is called by the method when deserializing the object from a stream.

  Initializes a new instance of the class with serialized data.

  The object that contains the serialized data.
  The stream that contains the serialized data.
- Constructor
  4.0.0.0

  Typically, you use this overload to handle an exception in a try/catch block. The parameter should be a reference to the exception object handled in the catch block, or it can be null. This value is then assigned to the object's property.

  The string is assigned to the property. The string should be localized for the current culture.

  Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception.

  A string that describes the exception.
  The exception that is the cause of the current exception.
- Constructor
  4.0.0.0

  The , , and values are assigned to the , , and properties of the new object.

  Initializes a new instance of the class with information about the regular expression pattern, the input text, and the time-out interval.

  The input text processed by the regular expression engine when the time-out occurred.
  The pattern used by the regular expression engine when the time-out occurred.
  The time-out interval.
- Property
  4.0.0.0
  System.String To be added.

  This property reflects the value of the parameter of the constructor. If this parameter is not explicitly initialized in a constructor call, its value is .

  When the exception is thrown by the regular expression engine, the value of the property reflects the entire input string passed to the regular expression engine. It does not reflect a partial string, such as the substring that the engine searches in the call to a method such as .

  Gets the input text that the regular expression engine was processing when the time-out occurred.

- Property
  4.0.0.0
  System.TimeSpan To be added.

  This property reflects the value of the parameter of the constructor. If the parameter is not properly initialized in a constructor call, its value is Timespan.FromTicks(-1).

  The value of this property reflects the time-out interval set in the call to the constructor or static method. It does not reflect the exact interval that has elapsed from the beginning of the method call to the time the exception is thrown.

  Gets the time-out interval for a regular expression match.

- Property
  4.0.0.0
  System.String To be added.

  This property reflects the value of the parameter of the constructor. If the parameter is not properly initialized in a constructor call, its value is .

  Gets the regular expression pattern that was used in the matching operation when the time-out occurred.