FabricObjectClosedException Class

Definition

The exception that is thrown when the Service Fabric object is currently in a closed state due to one of the following conditions: 1. The Service Fabric object is being deleted. 2. The Service Fabric object is not reachable due to a failover.

public class FabricObjectClosedException : System.Fabric.FabricException
type FabricObjectClosedException = class
    inherit FabricException
Public Class FabricObjectClosedException
Inherits FabricException
Inheritance
FabricObjectClosedException

Remarks

For example, this exception can be observed when a service attempts to perform an operation on a Service Fabric or FabricReplicator object while it is in the closed state. Another example is when an API is invoked on a FabricClient object when it is in the closed state.

Handling FabricObjectClosedException for FabricClient calls: If a FabricClient call sees FabricObjectClosedException, see FabricClient Exception Handling for handling common FabricClient failures.

Handling FabricObjectClosedException for Reliable Collections : 1. If the service sees FabricObjectClosedException in RunAsync, it should catch the exception and return from RunAsync. The CancellationToken passed to RunAsync would be signalled. All background tasks should complete execution when this cancellation is signalled. 2. If the service sees FabricObjectClosedException while processing a client request (e.g. via their communication listener), the service should throw the exception to the client to signal the client that it should re-resolve the service in order to locate the new Primary.

  [NOTE] If an <a href="https://docs.microsoft.com/dotnet/api/microsoft.servicefabric.data.ireliablestate?view=azure-dotnet">IReliableState</a> was removed via <a href="https://docs.microsoft.com/dotnet/api/microsoft.servicefabric.data.ireliablestatemanager.removeasync?view=azure-dotnet#Microsoft_ServiceFabric_Data_IReliableStateManager_RemoveAsync_Microsoft_ServiceFabric_Data_ITransaction_System_Uri_System_TimeSpan_">IReliableStateManager.RemoveAsync()</a>,
  any calls trying to access this <a href="https://docs.microsoft.com/dotnet/api/microsoft.servicefabric.data.ireliablestate?view=azure-dotnet">IReliableState</a> would see <xref data-throw-if-not-resolved="true" uid="System.Fabric.FabricObjectClosedException"></xref>. These calls needs to be synchronized with the <a href="https://docs.microsoft.com/dotnet/api/microsoft.servicefabric.data.ireliablestatemanager.removeasync?view=azure-dotnet#Microsoft_ServiceFabric_Data_IReliableStateManager_RemoveAsync_Microsoft_ServiceFabric_Data_ITransaction_System_Uri_System_TimeSpan_">IReliableStateManager.RemoveAsync()</a> call and should know that the <a href="https://docs.microsoft.com/dotnet/api/microsoft.servicefabric.data.ireliablestate?view=azure-dotnet">IReliableState</a> has been removed.
  Possible ways to handle this case are:
      1. Recreate the <a href="https://docs.microsoft.com/dotnet/api/microsoft.servicefabric.data.ireliablestate?view=azure-dotnet">IReliableState</a> if it was removed and retry the operation.
      2. Ignore the <a href="https://docs.microsoft.com/dotnet/api/microsoft.servicefabric.data.ireliablestate?view=azure-dotnet">IReliableState</a> and process other <a href="https://docs.microsoft.com/dotnet/api/microsoft.servicefabric.data.ireliablestate?view=azure-dotnet">IReliableState</a> in the service.
      3. Use locks to avoid the race. Hence if a remove call comes in, the user can stop processing the <a href="https://docs.microsoft.com/dotnet/api/microsoft.servicefabric.data.ireliablestate?view=azure-dotnet">IReliableState</a> further.

Constructors

FabricObjectClosedException()

Initializes a new instance of FabricObjectClosedException class with error code Unknown.

FabricObjectClosedException(FabricErrorCode)

Initializes a new instance of FabricObjectClosedException class with a specified error code.

FabricObjectClosedException(SerializationInfo, StreamingContext)

Initializes a new instance of FabricObjectClosedException class from a serialized object data, with a specified context.

FabricObjectClosedException(SerializationInfo, StreamingContext, FabricErrorCode)

Initializes a new instance of FabricObjectClosedException class from a serialized object data, with specified context and error code.

FabricObjectClosedException(String)

Initializes a new instance of FabricObjectClosedException class with error code Unknown and a specified error message.

FabricObjectClosedException(String, Exception)

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

FabricObjectClosedException(String, Exception, FabricErrorCode)

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

FabricObjectClosedException(String, FabricErrorCode)

Initializes a new instance of FabricObjectClosedException class.

Properties

ErrorCode

Gets the error code parameter.

(Inherited from FabricException)

Applies to