title: Why is loosely coupled event generated with Prism EventAggregator not received by its subscriber?
body: <p>In my Prism 6 WPF MVVM modular application (using Unity DI) I want to do communicating between modules using loosely coupled event - one module is publisher and the other modules are subscribers. On the side of publisher in AuthorizationViewModel class I have, in particular, the following methods:</p>
  
  <pre><code>public class AuthorizationViewModel : BindableBase
  {
      . . . . .
      // This method is called from the command method when user clicks button in the view.
      private void authenticateUser(string userName, string userPassword, Action&lt;UserAuthorizationLevel&gt; successCallback, Action&lt;string&gt; failureCallback)
      {
          Task task = Task.Run(() =&gt;
                this.getUsers((users) =&gt;
                {
                    // Get authenticated user information.
                    var userAuthenticated = GetUserByNameAndPassword(userName, userPassword, users);
                    // Call method publishing loosely coupled event if the user exists. Else display the error message.
                    if (userAuthenticated != null)
                        successCallback(userAuthenticated.AuthorizationLevel);
                    else
                        failureCallback("Authentification failed.");
                }));
      }
      . . . . .
  }
  </code></pre>
  
  <p>Below is successCalback definition that is in AuthorizationViewModel class too:</p>
  
  <pre><code>private void successCalback(UserAuthorizationLevel authorizationLevel)
  {
      // Publish loosely coupled event.
      this._eventAggregator.GetEvent&lt;UserAuthorizationLevelDeterminedEvent&gt;().Publish(authorizationLevel);
  }
  </code></pre>
  
  <p>UserAuthorizationLevel here is enum type defined in a common place of my application solution and I don't display it here. UserAuthorizationLevelDeterminedEvent is the event type that is also defined in a common place of my application solution. Below I display it: </p>
  
  <pre><code>public class UserAuthorizationLevelDeterminedEvent : PubSubEvent&lt;UserAuthorizationLevel&gt;
  {
  }
  </code></pre>
  
  <p>successCalback method runs whenever it is necessary and its line of code</p>
  
  <pre><code>this._eventAggregator.GetEvent&lt;UserAuthorizationLevelDeterminedEvent&gt;().Publish(authorizationLevel);
  </code></pre>
  
  <p>executes fine so event is published but the subscriber doesn't react to event at all! There is no response to event on subscriber side! Below I display code on subscriber side:</p>
  
  <pre><code>public class CalibrationNavigationItemViewModel : BindableBase
  {
      . . . . .
      private IEventAggregator _eventAggregator;
      . . . . .
      // The constructor; creates instance of CalibrationNavigationItemViewModel.
      public CalibrationNavigationItemViewModel(IRegionManager regionManager, IEventAggregator eventAggregator)
      {
          . . . . .
          this._eventAggregator = eventAggregator;
          this._eventAggregator.GetEvent&lt;UserAuthorizationLevelDeterminedEvent&gt;().Subscribe(this.setRadiobuttonVisualStatus, ThreadOption.BackgroundThread);
          . . . . .
      }
      . . . . .
      // Changes visual status of Radiobutton in the View.
      private void setRadiobuttonVisualStatus(UserAuthorizationLevel userAuthorizationLevel)
      {
          if (userAuthorizationLevel == UserAuthorizationLevel.Manufacturer)
              this.IsVisible = Visibility.Visible;
          else
              this.IsVisible = Visibility.Collapsed;
      }
  
      // Controls visual status of Radiobutton in the View; the Visibility property
      // of Radiobutton in the View is bound to this property.
      public Visibility IsVisible
      {
          get { return this._isVisible; }
          set { this.SetProperty(ref this._isVisible, value); }
      }
  }
  </code></pre>
  
  <p>(<em>I bag your pardon I'll make a bad break here: I'm controlling visibility status of Radiobutton in module instead of loading module itself dynamically because my application must give an opportunity to change users within the same one session. Prism module can't be unloaded after its initializing.</em>) Now, returning to our sheep; I set ThreadOption.BackgroundThread on the subscriber side because the publisher publishes the event in TPL Task but not in the UI thread. I'd like to know: <strong>Why does subscriber not react to published event at all?</strong> What I'm doing wrong? Please help me.</p>