title: NServiceBus 4 (RC1) - ReflectionTypeLoadException
body: <p>what is the best way of troubleshooting this issue?
  obviously "try… catch" in the endpointconfig (as something like below) 
  can't help, because the exception occurs earlier.
  this seems so basic,but I am totally stuck here(:</p>
  
  <pre><code>public class EndpointConfig : IConfigureThisEndpoint, AsA_Publisher, UsingTransport&lt;Msmq&gt;, IWantCustomInitialization
      {
          public void Init()
          {
              try
              {              
                  Configure
                      .With()
                      .StructureMapBuilder(ObjectFactory.Container)
                      .NLog(new NLog.Targets.FileTarget
                      {
                          FileName = "${basedir}/logs/${shortdate}.log",
                          Layout = "${longdate} ${uppercase:${level}} ${message}"
                      })
                      .UnicastBus();               
              }
              catch (Exception ex)
              {
  
                  Console.WriteLine(ex);
              }
          }
      }
  </code></pre>
  
  <p><em><strong></em>*</strong> EXCEPTION*<em>*</em>*</p>
  
  <pre><code>Magnum.StateMachine.StateMachineException: Exception occu
  rred in Topshelf.Internal.ServiceController`1[[NServiceBus.Hosting.Windows.Windo
  wsHost, NServiceBus.Host, Version=4.0.0.0, Culture=neutral, PublicKeyToken=9fc38
  6479f8a226c]] during state Initial while handling OnStart ---&gt; Microsoft.Practic
  es.ServiceLocation.ActivationException: Activation error occured while trying to
   get instance of type WindowsHost, key "MusicMind.Host.EndpointConfig, MusicMind
  .Host, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" ---&gt; System.Reflec
  tion.ReflectionTypeLoadException: Mindestens ein Typ in der Assembly kann nicht
  geladen werden. Rufen Sie die LoaderExceptions-Eigenschaft ab, wenn Sie weitere
  Informationen benötigen.
     bei System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
     bei System.Reflection.RuntimeModule.GetTypes()
     bei System.Reflection.Assembly.GetTypes()
     bei NServiceBus.Hosting.Helpers.AssemblyListExtensions.&lt;AllTypes&gt;d__0.MoveNex
  t() in c:\TeamCity\buildAgent\work\28bfdd0d351fb1d3\src\NServiceBus.Core\Hosting
  \Helpers\AssemblyListExtensions.cs:Zeile 14.
     bei System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
     bei System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
     bei System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
     bei NServiceBus.Hosting.Profiles.ProfileManager..ctor(List`1 assembliesToScan
  , IConfigureThisEndpoint specifier, String[] args, List`1 defaultProfiles) in c:
  \TeamCity\buildAgent\work\28bfdd0d351fb1d3\src\NServiceBus.Core\Hosting\Profiles
  \ProfileManager.cs:Zeile 33.
     bei NServiceBus.Hosting.GenericHost..ctor(IConfigureThisEndpoint specifier, S
  tring[] args, List`1 defaultProfiles, String endpointName, IEnumerable`1 scannab
  leAssembliesFullName) in c:\TeamCity\buildAgent\work\28bfdd0d351fb1d3\src\NServi
  ceBus.Core\Hosting\GenericHost.cs:Zeile 173.
     bei NServiceBus.Hosting.Windows.WindowsHost..ctor(Type endpointType, String[]
   args, String endpointName, Boolean runOtherInstallers, IEnumerable`1 scannableA
  ssembliesFullName) in c:\TeamCity\buildAgent\work\28bfdd0d351fb1d3\src\hosting\N
  ServiceBus.Hosting.Windows\WindowsHost.cs:Zeile 29.
     bei NServiceBus.Hosting.Windows.HostServiceLocator.DoGetInstance(Type service
  Type, String key) in c:\TeamCity\buildAgent\work\28bfdd0d351fb1d3\src\hosting\NS
  erviceBus.Hosting.Windows\HostServiceLocator.cs:Zeile 34.
     bei Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Ty
  pe serviceType, String key) in c:\Home\Chris\Projects\CommonServiceLocator\main\
  Microsoft.Practices.ServiceLocation\ServiceLocatorImplBase.cs:Zeile 49.
     --- Ende der internen Ausnahmestapelüberwachung ---
     bei Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Ty
  pe serviceType, String key) in c:\Home\Chris\Projects\CommonServiceLocator\main\
  Microsoft.Practices.ServiceLocation\ServiceLocatorImplBase.cs:Zeile 57.
     bei Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance[TS
  ervice](String key) in c:\Home\Chris\Projects\CommonServiceLocator\main\Microsof
  t.Practices.ServiceLocation\ServiceLocatorImplBase.cs:Zeile 103.
     bei Topshelf.Internal.ServiceController`1.BuildInstance() in c:\Projects\TopS
  helfForNSB\src\Topshelf\Internal\ServiceController.cs:Zeile 93.
     bei Magnum.StateMachine.EventActionList`1.Execute(T stateMachine, Event event
  , Object parameter) in :Zeile 0.
     --- Ende der internen Ausnahmestapelüberwachung ---
     bei Magnum.StateMachine.ExceptionActionDictionary`1.HandleException(T stateMa
  chine, Event event, Object parameter, Exception exception) in :Zeile 0.
     bei Magnum.StateMachine.EventActionList`1.Execute(T stateMachine, Event event
  , Object parameter) in :Zeile 0.
     bei Magnum.StateMachine.State`1.RaiseEvent(T instance, BasicEvent`1 eevent, O
  bject value) in :Zeile 0.
     bei Magnum.StateMachine.StateMachine`1.RaiseEvent(Event raised) in :Zeile 0.
     bei Topshelf.Internal.ServiceControllerProxy.Start()
     bei Topshelf.Internal.ServiceCoordinator.Start() in c:\Projects\TopShelfForNS
  B\src\Topshelf\Internal\ServiceCoordinator.cs:Zeile 54.
     bei Topshelf.Internal.Hosts.ConsoleHost.Run() in c:\Projects\TopShelfForNSB\s
  rc\Topshelf\Internal\Hosts\ConsoleHost.cs:Zeile 53.
     bei NServiceBus.Hosting.Windows.Program.Main(String[] args) in c:\TeamCity\bu
  ildAgent\work\28bfdd0d351fb1d3\src\hosting\NServiceBus.Hosting.Windows\Program.c
  s:Zeile 135.
  </code></pre>
  
  <p><strong>EDIT</strong>
  i found the solution!
  see my last comment!</p>