OK, me personally i had just a problem, that on android a barcodde was scanned, on ios not. So i asked Claude. He told me that ios works differently and that it only allows 14 characters on an itf code, android not but therefore i need i2of5, what me wondered, because it works on android and i2of5 is not marked in your readme for it. But anyways, without my issue, because i think the adding i2of5 will fix my problem, claude told me, that there is a problem in your lib which is well known/documented and could be fixed easily. So i will provide you the info with hope you can verify and ignore if bs and use it if its good. And thanks btw for your good library.:
In both the iOS and Android CameraManager.PerformBarcodeDetection (and PerformBarcodeDetectionAsync on Android), the AimMode and ViewfinderMode filters remove items from barcodeResults while iterating over it with foreach. Since barcodeResults is a HashSet, this invalidates the enumerator and throws InvalidOperationException: Collection was modified; enumeration operation may not execute. The outer try/catch swallows the exception, so DetectionFinished is never called for that frame and every result — including valid ones that would have passed the filter — is silently lost.
Affected code
Platforms/iOS/CameraManager.cs — PerformBarcodeDetection:
if (this.cameraView.AimMode)
{
var previewCenter = new Point(this.previewLayer.Bounds.Width / 2,
this.previewLayer.Bounds.Height / 2);
foreach (var barcode in this.barcodeResults)
{
if (!barcode.PreviewBoundingBox.Contains(previewCenter))
{
this.barcodeResults.Remove(barcode); // <-- modifies set during foreach
}
}
}
if (this.cameraView.ViewfinderMode)
{
var previewRect = new RectF(0, 0,
(float)this.previewLayer.Bounds.Width,
(float)this.previewLayer.Bounds.Height);
foreach (var barcode in this.barcodeResults)
{
if (!previewRect.Contains(barcode.PreviewBoundingBox))
{
this.barcodeResults.Remove(barcode); // <-- same issue
}
}
}
The Android CameraManager.PerformBarcodeDetectionAsync has the same two blocks with the same pattern.
Why it manifests platform-asymmetrically
In practice this bug affects iOS users far more than Android users when filters are enabled. Apple Vision returns relatively tight bounding boxes for 1D barcodes (a thin strip around the bars), so PreviewBoundingBox.Contains(previewCenter) fails frequently unless the user aims pixel-perfectly — triggering the Remove path on almost every frame. Google ML Kit on Android returns more generous bounding boxes for 1D codes, so the filter matches cleanly and the buggy Remove path is rarely hit. Result: with AimMode="True", 1D codes are effectively unscannable on iOS while the same code works fine on Android.
Reproduction
A MAUI app with a CameraView that has AimMode="True" (or ViewfinderMode="True").
Any BarcodeFormats including a 1D format, e.g. Code128 | QR | DataMatrix | ITF.
Point the camera at a small 1D barcode (e.g. Code 128) on iOS, not perfectly centered.
Observed: no detection is ever surfaced to the consumer.
Expected: detections that pass the filter should still reach DetectionFinished.
Suggested fix
Either iterate over a snapshot, or use RemoveWhere:
// Option A — snapshot:
foreach (var barcode in this.barcodeResults.ToList())
{
if (!barcode.PreviewBoundingBox.Contains(previewCenter))
this.barcodeResults.Remove(barcode);
}
// Option B — RemoveWhere (cleaner):
this.barcodeResults.RemoveWhere(b => !b.PreviewBoundingBox.Contains(previewCenter));
this.barcodeResults.RemoveWhere(b => !previewRect.Contains(b.PreviewBoundingBox));
Secondary observation (optional, separate concern)
BarcodeFormatMapper.ToPlatform() on iOS maps BarcodeFormats.ITF → VNBarcodeSymbology.Itf14 only (strict 14-digit). Variable-length Interleaved 2-of-5 requires the separate BarcodeFormats.I2OF5 flag. On Android, BarcodeFormats.ITF → ML Kit's Barcode.FormatItf, which covers all I2OF5 lengths. This cross-platform asymmetry is surprising; worth documenting in the README if intentional, or aliasing ITF to include I2OF5+I2OF5Checksum on iOS.
Thanks for the library!
OK, me personally i had just a problem, that on android a barcodde was scanned, on ios not. So i asked Claude. He told me that ios works differently and that it only allows 14 characters on an itf code, android not but therefore i need i2of5, what me wondered, because it works on android and i2of5 is not marked in your readme for it. But anyways, without my issue, because i think the adding i2of5 will fix my problem, claude told me, that there is a problem in your lib which is well known/documented and could be fixed easily. So i will provide you the info with hope you can verify and ignore if bs and use it if its good. And thanks btw for your good library.:
In both the iOS and Android CameraManager.PerformBarcodeDetection (and PerformBarcodeDetectionAsync on Android), the AimMode and ViewfinderMode filters remove items from barcodeResults while iterating over it with foreach. Since barcodeResults is a HashSet, this invalidates the enumerator and throws InvalidOperationException: Collection was modified; enumeration operation may not execute. The outer try/catch swallows the exception, so DetectionFinished is never called for that frame and every result — including valid ones that would have passed the filter — is silently lost.
Affected code
Platforms/iOS/CameraManager.cs — PerformBarcodeDetection:
The Android CameraManager.PerformBarcodeDetectionAsync has the same two blocks with the same pattern.
Why it manifests platform-asymmetrically
In practice this bug affects iOS users far more than Android users when filters are enabled. Apple Vision returns relatively tight bounding boxes for 1D barcodes (a thin strip around the bars), so PreviewBoundingBox.Contains(previewCenter) fails frequently unless the user aims pixel-perfectly — triggering the Remove path on almost every frame. Google ML Kit on Android returns more generous bounding boxes for 1D codes, so the filter matches cleanly and the buggy Remove path is rarely hit. Result: with AimMode="True", 1D codes are effectively unscannable on iOS while the same code works fine on Android.
Reproduction
A MAUI app with a CameraView that has AimMode="True" (or ViewfinderMode="True").
Any BarcodeFormats including a 1D format, e.g. Code128 | QR | DataMatrix | ITF.
Point the camera at a small 1D barcode (e.g. Code 128) on iOS, not perfectly centered.
Observed: no detection is ever surfaced to the consumer.
Expected: detections that pass the filter should still reach DetectionFinished.
Suggested fix
Either iterate over a snapshot, or use RemoveWhere:
Secondary observation (optional, separate concern)
BarcodeFormatMapper.ToPlatform() on iOS maps BarcodeFormats.ITF → VNBarcodeSymbology.Itf14 only (strict 14-digit). Variable-length Interleaved 2-of-5 requires the separate BarcodeFormats.I2OF5 flag. On Android, BarcodeFormats.ITF → ML Kit's Barcode.FormatItf, which covers all I2OF5 lengths. This cross-platform asymmetry is surprising; worth documenting in the README if intentional, or aliasing ITF to include I2OF5+I2OF5Checksum on iOS.
Thanks for the library!