title: Cannot publish event in NServiceBus - Message type could not be determined by a 'Type.GetType', scanning known messages for a match
body: <p>I ran into a strange issue with publishing events to MSMQ using NServiceBus. I can successfully send messages using <code>IBus.Send</code> method (I can find the sent messages in MSMQ). However, when I try to publish an event using <code>IBus.Publish</code> method, the messages do not reach MSMQ. For each published message I only get the following log message.</p>
  
  <pre><code>[DEBUG] 2015-11-20 13:19:43.9444 Message type: 'MyAssembly.Messages.NewEmailEvent' could not be determined by a 'Type.GetType', scanning known messages for a match 
  </code></pre>
  
  <p>The event definition looks like this.</p>
  
  <pre><code>namespace MyAssembly.Messages
  {
      public class NewEmailEvent
      {
          public Guid MessageId { get; set; }
          public string Subject { get; set; }
          public string Sender { get; set; }
          // a few other fields
      }
  }
  </code></pre>
  
  <p>I am publishing the event using the following code.</p>
  
  <pre><code>m_Bus.Publish&lt;NewEmailEvent&gt;(msg =&gt; {
      msg.MessageId = entry.MessageId;
      msg.Subject = entry.Email.Subject;
      msg.Sender = entry.Email.Sender.Name;
      // more property assignments
  });
  </code></pre>
  
  <p>I have the following routing configuration.</p>
  
  <pre><code>&lt;MsmqTransportConfig InputQueue="Nsb_input" ErrorQueue="Nsb_errors" NumberOfWorkerThreads="1" MaxRetries="5" /&gt;
  &lt;MessageForwardingInCaseOfFaultConfig ErrorQueue="error" /&gt;
  &lt;UnicastBusConfig&gt;
    &lt;MessageEndpointMappings&gt;
      &lt;add Assembly="MyAssembly.Messages" Endpoint="NServiceBus.Service" /&gt;
    &lt;/MessageEndpointMappings&gt;
  &lt;/UnicastBusConfig&gt;
  </code></pre>
  
  <p>The event naming conventions are defined in code as follows.</p>
  
  <pre><code>busConfiguration.Conventions().DefiningEventsAs(
      t =&gt; t.Assembly.GetName().Name.EndsWith(".Messages", StringComparison.InvariantCulture)
          &amp;&amp; t.Name.EndsWith("Event", StringComparison.InvariantCulture));
  </code></pre>
  
  <p>The messages are correctly registered at startup.</p>
  
  <pre><code>[DEBUG] 2015-11-20 13:18:35.1345 Message definitions: 
  MessageType: MyAssembly.Messages.NewEmailEvent, Recoverable: True, TimeToBeReceived: Not set , Parent types: MyAssembly.Messages.NewEmailEvent
  MessageType: NServiceBus.Scheduling.Messages.ScheduledTask, Recoverable: True, TimeToBeReceived: Not set , Parent types: NServiceBus.Scheduling.Messages.ScheduledTask
  </code></pre>
  
  <p>On the receiving end, I am subscribing to the event using the following code.</p>
  
  <pre><code>bus.Subscribe&lt;NewEmailEvent&gt;();
  </code></pre>
  
  <p>And using the following configuration.</p>
  
  <pre><code>&lt;UnicastBusConfig&gt;
    &lt;MessageEndpointMappings&gt;
      &lt;add Assembly="MyAssembly.Messages" Endpoint="NServiceBus.Service" /&gt;
    &lt;/MessageEndpointMappings&gt;
  &lt;/UnicastBusConfig&gt;
  &lt;MessageForwardingInCaseOfFaultConfig ErrorQueue="error" /&gt;
  </code></pre>
  
  <p>The event naming conventions are the same as the service.</p>