question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ServiceBase.GetCharacteristicsAsync() throws ArgumentException: length

See original GitHub issue

This error is happening extremely often and only on Android.

It’s easy workaround, just adding a try catch and calling the method again fixes it.

Steps to reproduce

  1. Request characteristics

Expected behavior

Characteristics should be loaded.

Actual behavior

Method throws an exception.

Crashlog

ServiceBase.GetCharacteristicsAsync () System.ArgumentException: length

System 
Array.Copy (System.Array sourceArray, System.Int32 sourceIndex, System.Array destinationArray, System.Int32 destinationIndex, System.Int32 length)

System.Collections.Generic 
List`1[T].CopyTo (T[] array, System.Int32 arrayIndex)

System.Collections.Generic.List`1[T] 
System.Collections.Generic.List`1[T]..ctor (System.Collections.Generic.IEnumerable`1[T] collection) [0x0003b] in <ca00b961ae9e43f0bc6166bec1195ff4>:0

System.Linq 
Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source)

Plugin.BLE.Abstractions 
ServiceBase.GetCharacteristicsAsync ()

Plugin.BLE.Abstractions 
ServiceBase.GetCharacteristicAsync (System.Guid id)

Configuration

Version of the Plugin: 2.1.3

Platform:

  • Android 10
  • Android 11
  • Android 12
  • Android 13

Device:

  • Galaxy A52s 5G
  • Galaxy S21 5G
  • P30 Pro
  • Galaxy A51
  • HUAWEI P30 lite
  • Galaxy S9
  • Galaxy S10
  • Galaxy S20 FE
  • Galaxy S20 FE 5G
  • Galaxy A50

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
TomasMalcanekcommented, Jun 5, 2023

I don’t think it’s a duplicate, it might be worth a mention, but the stack traces and when it occurs are different.

No clear reproducer made yet. Collecting information about this is slow as it’s again one of those bugs that don’t happen on the dev side.

0reactions
busec0commented, Jun 5, 2023
Read more comments on GitHub >

github_iconTop Results From Across the Web

xamarin-bluetooth-le
Hi there,. Question: I've got a "vanilla"-App using this plugin. It works quite well, however, the amount of time of connections made by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found