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.
Our deployed app, built with 4.2.2 generates 2-3 crash logs per day that always look like the following:
Exception: Incompatible Delegate Types.
at System.Delegate.Combine (System.Delegate a, System.Delegate b) [0x00000] in <filename unknown>:0
at Foo.Bar.MyClass.add_MyEvent (Foo.Bar.MyEventHandler value) [0x00000] in <filename unknown>:0
Similar exceptions can be thrown from anywhere that adding an event handler occurs. There seems to be no pattern of class type of handler type that specifically triggers this or is immune to this. Obviously, this code succeeds the vast majority of the time and fails seemingly at random.
The only pattern is that most of the codepaths that are throwing this exception occur right around application startup. However, that is also when most event handler addition occurs so it may not be connected to the problem.
Hi Anthony, there have been a bunch of fixes in this area in the last few stable releases.
Did you encounter this bug since 4.6?
We are shipping w/ 4.6.x and haven't seen this recently. I'll close. Thanks!
This bug should be reopened as it is not resolved.
I am seeing this occur with Xamarin.Android 4.8.1 when running on a Nexus 10 with Android 4.3. It is not intermittent, and happens frequently.
Relavent stacktrace: http://sprunge.us/XXeV
Reopening it then. We updated that code over a year ago to include the types involved in the exception message. Could you paste them?
From the interface definition:
event Action<Source, int, ContextMenuItemAction> SourceContextActionActivated;
And the signature of the handler that is added:
private void view_SourceContextActionActivated(Source source, int index, ContextMenuItemAction action)
Source is class and ContextMenuItemAction is an enum.
What's really frustrating/confusing is that this works *some* times, but not all.
Doh, sorry, I misread your last comment:
That contains the types from the exception.
The delegate been appended is Action<object, int, int, Track, object>, does it ring any bell?
So there 2 places where we have Actions with that signature, well the signature has a generic:
Action<object, int, int, TModel, object>
One is an event on our BaseListAdapter class (called ItemActionActivated), and the other is an ivar in ListActivationListener. But neither of those instances would ever be added to the SourceContextActionActivated event on BaseContextMenuFragment.
Is there anything else I can do to help troubleshoot?
It give some food for though. I'll spend some time here next week.
Fixed, will be part of android 4.10.2.
I have verified this issue following are the steps:
1. Created android project
2. Create a class for event and combine two events using System.Delegate.Combine() method.
Refer screen shot: http://www.screencast.com/t/Kky4TTXgf
XS 4.2.3 (Build 35)