2
votes

I'm using the portable library in a Xamarin forms project on an android device.

When I add a tile a modal on the device asks me to allow adding a tile and then the app throws this exception:

com.microsoft.band.BandException: Unknown error DEVICE_COMMAND_RESPONSE_ERROR occurred.

at Microsoft.Band.Portable.Tiles.BandTileManager+d__5.MoveNext () [0x0003d] in C:\Projects\MSBand\Microsoft.Band.Portable\Microsoft.Band.Portable\Tiles\BandTileManager.cs:69

Which seems to be running this code:

https://github.com/mattleibow/Microsoft-Band-SDK-Bindings/blob/master/Microsoft.Band.Portable/Microsoft.Band.Portable/Tiles/BandTileManager.cs

#if __ANDROID__
            result = await ActivityWrappedActionExtensions.WrapActionAsync(activity =>
            {
                return Native.AddTileTaskAsync(activity, tile.ToNative());
            });

Here is my source: https://gist.github.com/missaghi/c39099a52a7b13c463fa

1

1 Answers

2
votes

Have you tried debugging your code and seeing which line the error occurs on?

MoveNext typically refers to an IEnumerable (collection), and it might not have all the info it needs to move to the next member in a collection or the collection maybe null (hasn't been returned from some sort of await).

I can see that you have nested await statements in creation of objects.

It could be possible that the await thread might behave differently by doing this and it may have not created the objects with all of the required properties for it be to added to the tile collection. So try creating/awaiting any dependencies in the main thread first, then feed them into the object creation code.

Additionally, try wrapping your code in different sections of try - catch blocks to further drill down on where the error is happening and retrieve more info about the error.