Bug 51703 - MessagingCenter.Unsubscribe unsubbs ALL instances that has subscribed to the message
Summary: MessagingCenter.Unsubscribe unsubbs ALL instances that has subscribed to the ...
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.4
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-01-23 14:12 UTC by Björn Bentmar
Modified: 2017-01-24 22:43 UTC (History)
6 users (show)

Tags: pre1 ac
Is this bug a regression?: Yes
Last known good build: pre1

Reproduction_Project_MessaginCenter_Bug (237.23 KB, application/zip)
2017-01-23 14:12 UTC, Björn Bentmar

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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.

Related Links:

Description Björn Bentmar 2017-01-23 14:12:55 UTC
Created attachment 19443 [details]

My System:


Microsoft Visual Studio Enterprise 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01586

Installed Version: Enterprise

Visual Basic 2015   00322-80000-00000-AA424
Microsoft Visual Basic 2015

Visual C# 2015   00322-80000-00000-AA424
Microsoft Visual C# 2015

Visual C++ 2015   00322-80000-00000-AA424
Microsoft Visual C++ 2015

Application Insights Tools for Visual Studio Package   7.17.00119.9
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2015.1 (Beta8)   14.1.11107.0
ASP.NET and Web Tools 2015.1 (Beta8)

ASP.NET Web Frameworks and Tools 2012.2   4.1.41102.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.2.40314.0
For additional information, visit http://www.asp.net/

Common Azure Tools   1.8
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

Mono Debugging for Visual Studio   Mono.Debugging.VisualStudio
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager   3.4.4
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

Xamarin (ff5ef6d)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Inspector Support (1f3067d)
Adds support for inspecting Xamarin and WPF apps.

Xamarin.Android (3d959b6)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS (6a925ff)
Visual Studio extension to enable development for Xamarin.iOS.


The Bug (Actual Behaviour):
My projects creates objects that subscribe to a specific message via MessagingCenter. Add some subscribers and send the message and look at the output. Remove ONE subcriber and send the message again, Now all other instances of subscribers dont get the message, and they didnt unsubscribe. So in short, the bug is that when you unsubscribe from a message with MessagingCenter, all instances that subscribed to it will also be unsubscribed (not shure whats happening deep down in code but they dontget the message).

Expected behaviour:
Add 4 subscrubers, send message, look at output and see 4x messages received, remove a subscriber, send a message, look at output and see 3x messages received. 

This bug came in the latest prerelease of XF pre 1, the prior prerelase that was removed (XF pre1) does not have this bug. I have tested on android only (devices and emultors)

The attached project is super easy and detailed, it the latest prerelease. If you downgrade it, it will work as expected. There are really no lightweight workarounds for this so please fix this asap :)
Comment 1 Rui Marinho 2017-01-24 22:43:09 UTC
Should be fixed in 2.3.4-pre2