A developer who implements a subclass of the MediaProvider class must be aware of the exceptions that Microsoft Unified Communications Managed API (UCMA) expects.
BeginXxx can throw InvalidOperationException if an operation is not valid in the current state of the MediaProvider subclass implementation. The associated Call subclass should catch the exception and take appropriate action, depending on the operation state. Appropriate actions include terminating the call or retrying the operation.
A custom implementation of a Call subclass should not receive ArgumentException in general, because Call never passes a null value of OfferAnswerContext or CallContext. The MediaProvider can very well assert the value on any API where OfferAnswerContext is passed. The Call class has special logic for handling an OfferAnswerException exception, which is shown in the previous section of this topic.
An EndXxx method can throw only the exceptions that are derived from the RealTimeException class:
This module explores the use of exceptions and the exception handling process in C# console applications. Hands-on activities provide experience implementing exception handling patterns for various coding scenarios.