Oct 19, 2014 at 6:40 AM
Edited Oct 19, 2014 at 6:43 AM
I'm new in Windows Phone 8.1 development.
I'm doing a simple app to scan barcode using ZXing.Net and Windows Phone 8.1 SDK.
When I call the Decode method I got an exception with text of "Index was outside the bounds of the array"
Here is a portion of code:
InMemoryRandomAccessStream stream = new InMemoryRandomAccessStream();
await Camera.CapturePhotoToStreamAsync(ImageEncodingProperties.CreateJpeg(), stream);
var properties = Camera.VideoDeviceController.GetMediaStreamProperties(MediaStreamType.VideoPreview);
var videoEncodingProperties = properties as VideoEncodingProperties;
WriteableBitmap writableImg = new WriteableBitmap((int)videoEncodingProperties.Width, (int)videoEncodingProperties.Height);
result = barcode.Decode(writableImg);
if (result != null)
debug.Text = result.Text;
debug.Text = "No results";
I think the problem is with the size of the WritableImage, because when I run the app on the emulator (and definitely there is no barcode in it), the decoder decodes and returns no value (and that's ok), but when I run it on my WP8.1 device, I got an exception
with a text of:
"Index was outside the bounds of the array"
I tried to resize the writable image with no results! any help with that?