-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception "Destination array is not long enough to copy all the items in the collection. Check array index and length." happens in when running under debugger #200
Comments
Another exception you can get is:
Repro code: class Program
{
static Random random = new Random();
public static string RandomString(int length)
{
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#-*\"#-*\"#-*\"#-*\"#-*\"#-*\"#-*\"#-*\"#-*\"#-*\"";
return new string(Enumerable.Repeat(chars, length)
.Select(s => s[random.Next(s.Length)]).ToArray());
}
static void Main(string[] args)
{
TelemetryConfiguration.Active.TelemetryChannel.DeveloperMode = true;
TelemetryClient client = new TelemetryClient();
client.InstrumentationKey = "9d3ebb4f-7a11-4fb1-91ac-7ca8a17627eb";
Random r = new Random();
var counter = 0;
while (true)
{
EventTelemetry telemetry = new EventTelemetry();
int len = r.Next(50);
for (int i = 0; i < len; i++)
{
string key = RandomString(10);
if (!telemetry.Properties.ContainsKey(key))
telemetry.Properties.Add(key, RandomString(50));
Debug.WriteLine(key +" " + telemetry.Properties[key]);
}
Thread.Sleep(1000);
client.Track(telemetry);
//((ITelemetry)telemetry).Sanitize();
Debug.WriteLine(counter++.ToString() + " len: " + len);
}
}
} |
@SergeyKanzhelev Please merge the fix to master. We want to have it in the next stable version. |
Workaround is to set this flag:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Exception "Destination array is not long enough to copy all the items in the collection. Check array index and length." happens in when running under debugger:
The probable root cause is that Debug writer executes in parallel with the channel. Both of them doing sanitization by modifying the same collection in parallel.
The text was updated successfully, but these errors were encountered: