[Mono-list] Not all subscribers to event are being called...

Ryan Kirkpatrick ryan.kirkpatrick at inovonics.com
Wed Apr 29 21:26:22 EDT 2009


While porting a .NET library I wrote from Windows (VS2008) to Linux 
(Mono 2.x) I have encountered a strange problem. Here is a high-level 
description of what is going on:

*) Class Top has an event Run that can be subscribed by 'public'.

*) Class TopPlus inherits from Top and subscribes to Run.

*) Class Side takes TopPlus as a parameter to its constructor and 
subscribes to TopPlus.Run.

*) Now, I create an instance of TopPlus, 'tp', and use that instance in 
creating an instance of Side, 's'.

*) Finally, I call tp.Run(), and TopPlus' subscribe gets called, but 
Side's subscriber does not get run.

It is a bit more complex than this, but that is the gist of what is 
going on. What is curious is that I observed this behavior in versions 
of Mono older than 2.2, but it did not occur in 2.2 (i.e. both 
subscribers got called). I had figured the issue had already been found 
and fixed, but today in testing with Mono 2.4, this behavior (i.e. only 
TopPlus' subscriber being called) returned! I have run mono with the 
--trace option to verify Side's subscriber is indeed never being called 
when the event is called.

I can't provide code as it is proprietary, and my attempts to create a
simple test case so far have failed. I have narrowed it down to a 
runtime issue, as it does not matter if the library is built with Mono 
2.2, Mono 2.4, or VS2008. It is the version of '/usr/bin/mono' that is 
used that affects this behavior. I know this is all a bit vague, but 
before I write a long winded, detailed explanation of my library's 
architecture I would like to know if the above brings any know issues or 
workarounds to mind. Thanks!

-- 
Ryan Kirkpatrick <ryan.kirkpatrick at inovonics.com>
Senior Design Engineer
Inovonics Wireless Corporation


More information about the Mono-list mailing list