Datamatrix can only be read if centered on the screen with AVFoundation

I am using AVFoundation for a barcode scanner which must scan type datamatrix, but if it is not centered on the preview image it is not scanned, for example if the label with the datamatrix is at the top of the screen it cannot be scanned.

This my input device configuration

captureDevice.LockForConfiguration(out _);
captureDevice.FocusMode = AVCaptureFocusMode.ContinuousAutoFocus;
captureDevice.ExposureMode = AVCaptureExposureMode.ContinuousAutoExposure;
captureDevice.UnlockForConfiguration();

Preview and session

var previewLayer = AVCaptureVideoPreviewLayer.FromSession(_captureSession);
previewLayer.VideoGravity = AVLayerVideoGravity.ResizeAspectFill;
captureView.Layer.AddSublayer(previewLayer);
previewLayer.Frame = captureView.Bounds;
previewLayer.LayoutIfNeeded();
captureView.LayoutIfNeeded();
var con = previewLayer.Connection;
con.VideoOrientation = AVCaptureVideoOrientation.Portrait;
_captureSession.CommitConfiguration();
_captureSession.StartRunning();
outputMetadata.RectOfInterest = previewLayer.MapToMetadataOutputCoordinates(View.Frame);

Source: Xamarin.ios Questions