Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
I have a crash due to uncaught exception on that line:
I don't understand the logic here. You check that the dictionary contains a key and if it doesn't you access the dictionary entry for that key?
Terminating app due to uncaught exception 'System.AggregateException', reason: 'System.AggregateException: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. ---> System.IndexOutOfRangeException: Index was outside the bounds of the array. at System.Collections.Generic.Dictionary`2[TKey,TValue].Insert (TKey key, TValue value, System.Boolean add) <0x1003190a0 + 0x002c8> in <15e850188d9f425bbeae90f0bbc51e17#b5a87f601e65028d7a7238eeb2863873>:0 at System.Collections.Generic.Dictionary`2[TKey,TValue].set_Item (TKey key, TValue value) <0x100318150 + 0x00027> in <15e850188d9f425bbeae90f0bbc51e17#b5a87f601e65028d7a7238eeb2863873>:0 at Xamarin.Forms.MessagingCenter.InnerSubscribe (System.Object subscriber, System.String message, System.Type senderType, System.Type argType, System.Action`2[T1,T2] callback) <0x100c6db30 + 0x00177> in <b0fc14d4e5b04749b7241d1235a68329#b5a87f601e65028d7a7238eeb2863873>:0 at Xamarin.Forms.MessagingCenter.Subscribe[TSender] (System.Object subscriber, System.String message, System.Action`1[T] callback, TSender source) <0x100c6d6d0 + 0x00127>
I guess it's a typo and what you wanted to do is:
At first sight, that looks like an issue. Do you have a minimal repro?
Actually, looks like they are the same things with different impacts. See http://stackoverflow.com/a/1838494. Your issue might be different, so a repro will help.
Thanks, I learnt something today. I didn't know you could do dictionary[key] = value. Until now I thought Add was mandatory.
I was wondering how the code could even work as there was no s_callback.Add anywhere within the class.
Unfortunately I don't have a repro. I just got that report from HockeyApp for an app in prod. I can't reproduce the issue on my side yet.
The line throwing exception may actually even be
I'll dig further and revert here when I get more.
The line throwing the exception is
It's a threading issue apparently:
I'll make my Subscribe calls thread-safe.
That raises an interesting question. I do wonder if we should use ConcurrentDictionary in the implementation of MessagingCenter.
I redirected this to Jason.
Marking as need info as there is no repo and another issue has been created to further track this issue.
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Forms, since we've made some significant changes to the MessageCenter. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.
Here are some reproduction best practices: https://gist.github.com/jassmith/92405c300e54a01dcc6d