Bug 51703

Summary: MessagingCenter.Unsubscribe unsubbs ALL instances that has subscribed to the message
Product: Forms Reporter: Björn Bentmar <bjorn.bentmar>
Component: FormsAssignee: Bugzilla <bugzilla>
Severity: normal CC: bjorn.bentmar, david.ortinau, david, ehart, jas, rui.marinho
Priority: ---    
Version: 2.3.4   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Tags: pre1 ac Is this bug a regression?: Yes
Last known good build: pre1
Attachments: Reproduction_Project_MessaginCenter_Bug

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