After calling the UploadAsync() method of yours, I receive an error. That is Destination array was not long enough. Check the destination index, length, and the array's lower bounds. (Parameter 'destinationArray'). The related method is System.Array.Copy. The screenshot below is from Azure AppInsights
Starting from that point, I don't want to intervene in your codebase however I made some research to understand the reason for the error that I faced, and maybe the things I discovered will help you. In my opinion, the world becomes a better place if developers help other developers 😄
I cloned your SDK to my local environment and trace the codebase to be able to determine the exact place where the error is thrown.
In UploadQueue.Upload(object _, System.Timers.ElapsedEventArgs __) method, you are creating a list called baseEvents from another list called _events. My IDE, Rider, gives me a warning which is The field is sometimes used inside synchronized block and sometimes used without synchronization. A detailed description of the warning can be found in the official document of Rider.
The problem might be not using a thread-safe approach while creating the baseEvents collection.
Hello,
I want to consult you on an issue related to the SDK. In our API, we use the latest version of your SDK and have a code block below
After calling the
UploadAsync()
method of yours, I receive an error. That isDestination array was not long enough. Check the destination index, length, and the array's lower bounds. (Parameter 'destinationArray')
. The related method isSystem.Array.Copy
. The screenshot below is fromAzure AppInsights
Starting from that point, I don't want to intervene in your codebase however I made some research to understand the reason for the error that I faced, and maybe the things I discovered will help you. In my opinion, the world becomes a better place if developers help other developers 😄
I cloned your SDK to my local environment and trace the codebase to be able to determine the exact place where the error is thrown.
In
UploadQueue.Upload(object _, System.Timers.ElapsedEventArgs __)
method, you are creating a list calledbaseEvents
from another list called_events
. My IDE, Rider, gives me a warning which isThe field is sometimes used inside synchronized block and sometimes used without synchronization
. A detailed description of the warning can be found in the official document of Rider.The problem might be not using a thread-safe approach while creating the
baseEvents
collection.Furthermore, I have found similar issues posted to Stackoverflow, and here are the links 1) https://stackoverflow.com/a/14118859 2) https://stackoverflow.com/a/28715820 3) https://stackoverflow.com/a/61627737
I am open to your thoughts and ideas. Hope the above helps you.