Exception in SampleMonitorService

May 12, 2010 at 10:53 AM

Hi, everybody!

I'm trying to run the Monitor samples in the Solution (used latest sources - changeset 43903) but everytime I start an exception occurred in SampleMonitorService.

The exception occurs in LocalServiceManager.cs : virtual void StartLocalService(object service). The service-object is of type (SimpleServiceBus.Bus.Subscriptions.DefaultSubscriptionManager).

Not sure why this happens. Perhaps it's because I'm using Windows 7 ???

Any help on this object would be greatly appreciated.

Thanks in advance,

Micha

 

Here is the Exception Detail:

The given key was not present in the dictionary.
   at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at SimpleServiceBus.Bus.Subscriptions.XmlSubscriptionRepository.<>c__DisplayClass3.<GetAllSubscriptions>b__1(SerializableStoredSubscription s)
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at SimpleServiceBus.Bus.Subscriptions.XmlSubscriptionRepository.GetAllSubscriptions()
   at SimpleServiceBus.Bus.Subscriptions.DefaultSubscriptionManager.StartService()
   at SimpleServiceBus.Utilities.BackgroundServiceBase.Start()
   at SimpleServiceBus.Utilities.ServiceManager.LocalServiceManager.StartLocalService(Object service)
   at SimpleServiceBus.Endpoint.EndpointServiceManager.StartLocalService(Object service)
   at SimpleServiceBus.Utilities.ServiceManager.LocalServiceManager.StartService()
   at SimpleServiceBus.Endpoint.EndpointServiceManager.StartService()
   at SimpleServiceBus.Utilities.BackgroundServiceBase.Start()
   at SimpleServiceBus.Endpoint.MessagingEndpoint.StartService()
   at SimpleServiceBus.Utilities.BackgroundServiceBase.Start()
   at SampleManagedEndpoint.MainForm.StartEndpoint() in D:\Temp\SimpleServiceBus\SimpleServiceBus-43903x\SampleManagedEndpoint\MainForm.cs:line 74
   at SampleManagedEndpoint.MainForm.btnStartStop_Click(Object sender, EventArgs e) in D:\Temp\SimpleServiceBus\SimpleServiceBus-43903x\SampleManagedEndpoint\MainForm.cs:line 133

 
Coordinator
May 18, 2010 at 6:08 AM

Michael,

I'm using Win7 and I don't seem to have this problem. Is it possible you have an old version of some subscriptions on your machine? It seems to happen in GetAllSubscriptions where I assume it iterates thru all existing subscriptions. Maybe you see if you can clear those?

Dec 25, 2012 at 11:25 AM

I have the same problem, I did some debugging and I found the error happens in the following statement in the "XmlSubscriptionRepository" class in the "GetAllSubscriptions" method:

 

 

subscriptions.ForEach(
     s =>
     loaded.Add(new StoredSubscription { MessageType = _knownTypes[s.TypeName], Subscriber = s.Subscriber }));

 

and the problem happens because the "_knownTypes" dictionary doesn't have elements, it's of type Dicationary<string, Type> and I think it supposed to contains the registered message types as the key will be the name of the type and the value should be the "Type" object itself, the problem is this "_knownTypes" is not initialized correctly and always empty, and I think the fix of this issue will be done by initializing it with the registered types in the start of the "XmlSubscriptionRepository" service, I don't know if I'm right or there's something I'm missing like config or something else. So please, confirm with me or tell me what I'm missing.

Note: in my config file I already registered the assembly that contains my messages, so I don't think this is the problem, and also when I register it from code, it gives me the same error.

Thanks

Coordinator
Dec 27, 2012 at 5:50 AM

Since I can't reproduce it, please feel free to submit a patch and I can merge it in.