internal unsafe IntPtr ToNative(PinCollection pinCollection) { var nativeResult = new NativeTypes.FABRIC_PARTITION_QUORUM_LOSS_RESULT(); if (this.SelectedPartition != null) { nativeResult.SelectedPartition = this.SelectedPartition.ToNative(pinCollection); } nativeResult.ErrorCode = this.ErrorCode; return(pinCollection.AddBlittable(nativeResult)); }
internal unsafe void CreateFromNative(IntPtr pointer) { NativeTypes.FABRIC_PARTITION_QUORUM_LOSS_RESULT nativeResult = *(NativeTypes.FABRIC_PARTITION_QUORUM_LOSS_RESULT *)pointer; this.SelectedPartition = SelectedPartition.CreateFromNative(nativeResult.SelectedPartition); this.ErrorCode = nativeResult.ErrorCode; try { this.Exception = InteropHelpers.TranslateError(this.ErrorCode); } catch (FabricException) { // Exception could not be translated. To the user, it will look like whole FabricClient API itself failed, // instead of just the translation above, and they won't be able to determine what happened. So // instead, suppress this. The user will still have this.ErrorCode. We will still // be able to catch and fix situations that hit this case in test automation because // there be a check on this.Exception there. } }