/// <summary> /// Deserialize the header for the OperationData /// </summary> internal void DeserializeContext( OperationData operationData, int version, string traceType) { Utility.Assert( operationData != null, "{0}: DeserializeContext: Null named operation data during create", this.TraceType); Utility.Assert( operationData.Count > 0, "{0}:DeserializeContext: Named operation data should have atleast one buffer during create", this.TraceType); var headerBufferSPtr = operationData[operationData.Count - 1]; bool isStateProviderDataNull; using (InMemoryBinaryReader reader = new InMemoryBinaryReader(new MemoryStream( headerBufferSPtr.Array, headerBufferSPtr.Offset, headerBufferSPtr.Count))) { this.Version = reader.ReadInt32(); if (this.Version != version) { FabricEvents.Events.OnApplyVersionError(traceType, this.Version, version); throw new NotSupportedException( string.Format( CultureInfo.InvariantCulture, "Unsupported version {0} on deserialization, current version is {1}", this.Version, version)); } this.StateProviderId = reader.ReadInt64(); isStateProviderDataNull = reader.ReadBoolean(); } // Remove state manager metadata from data. operationData.RemoveAt(operationData.Count - 1); this.OperationData = isStateProviderDataNull ? null : operationData; }