0

I'm using the NES sample which works out of the box. Then I have swapped the NServiceBus 2.5 version with an older 2.0 but this results in the following error when starting the MVC application:

"Object reference not set to an instance of an object." at NES.EventConverterFactory..ctor() at NES.DI.<.cctor>b_6() in C:\Users\werner\Downloads\elliotritchie-NES-9a56ad8\elliotritchie-NES-9a56ad8\src\NES\DI.cs:line 24 at NES.DependencyInjectionContainer.ResolveTService in C:\Users\werner\Downloads\elliotritchie-NES-9a56ad8\elliotritchie-NES-9a56ad8\src\NES\DependencyInjectionContainer.cs:line 20 at NES.DependencyInjectionContainer.<>c_DisplayClass42.<Register>b__3() in C:\Users\werner\Downloads\elliotritchie-NES-9a56ad8\elliotritchie-NES-9a56ad8\src\NES\DependencyInjectionContainer.cs:line 45 at NES.DependencyInjectionContainer.Resolve[TService]() in C:\Users\werner\Downloads\elliotritchie-NES-9a56ad8\elliotritchie-NES-9a56ad8\src\NES\DependencyInjectionContainer.cs:line 20 at NES.DependencyInjectionContainer.<>c__DisplayClassa4.b_9() in C:\Users\werner\Downloads\elliotritchie-NES-9a56ad8\elliotritchie-NES-9a56ad8\src\NES\DependencyInjectionContainer.cs:line 59 at NES.DependencyInjectionContainer.ResolveTService in C:\Users\werner\Downloads\elliotritchie-NES-9a56ad8\elliotritchie-NES-9a56ad8\src\NES\DependencyInjectionContainer.cs:line 20 at NES.DependencyInjectionContainer.<>c_DisplayClass4`2.b__3() in C:\Users\werner\Downloads\elliotritchie-NES-9a56ad8\elliotritchie-NES-9a56ad8\src\NES\DependencyInjectionContainer.cs:line 45 at NES.DependencyInjectionContainer.ResolveTService in C:\Users\werner\Downloads\elliotritchie-NES-9a56ad8\elliotritchie-NES-9a56ad8\src\NES\DependencyInjectionContainer.cs:line 20 at NES.UnitOfWorkFactory.Begin() in C:\Users\werner\Downloads\elliotritchie-NES-9a56ad8\elliotritchie-NES-9a56ad8\src\NES\UnitOfWorkFactory.cs:line 18 at NES.NServiceBus.MessageModule.HandleBeginMessage() in C:\Users\werner\Downloads\elliotritchie-NES-9a56ad8\elliotritchie-NES-9a56ad8\src\NES\NServiceBus\MessageModule.cs:line 10 at NServiceBus.Unicast.UnicastBus.TransportStartedMessageProcessing(Object sender, EventArgs e) at NServiceBus.Unicast.Transport.Msmq.MsmqTransport.ReceiveFromQueue() at NServiceBus.Unicast.Transport.Msmq.MsmqTransport.Process()

Now this happens when the Global.asax.cs hits "AreaRegistration.RegisterAllAreas();". In the end, the error occurs in "EventConverterFactory.cs" line 13 where the static constructor tries to iterate "Global.TypesToScan" which is null.

Does anyone know how to get this sample going? It is odd that the exact same code seem to work with NSB 2.5 assemblies...

Werner

Werner
  • 1,229
  • 1
  • 10
  • 24
  • Hi Werner, I compiled the NSB v2.0 source against .NET 4 and ran the NES sample with these dlls and can't reproduce the error you're getting. Are there any changes to the sample projects other than referencing the older NSB dlls? – Elliot Ritchie Sep 17 '11 at 18:23
  • Hi Elliot, well I just pulled the latest NES and made sure that all I changed was the NSB assemblies in all 3 projects: NES, NES.Sample and NES.Sample.Web. Same error. Perhaps the problem is with NSB, I'm using 2.0.0.1329. Weird. – Werner Sep 19 '11 at 06:53
  • No, the latest 2.0 (2.0.0.1330) does the same. I don't understand how it can work for you. What version of NSB are you using? – Werner Sep 19 '11 at 07:37
  • I used the v2.0 branch on GitHub. I just tried again with the v2.0.0.1219 download on NServiceBus.com and the NES sample still seems fine. – Elliot Ritchie Sep 19 '11 at 09:21
  • Yes I got it working too. It seems that handling of the NSB CompletionMessage is different from 2.0->2.5. And it is the handling of the CompletionMessage that triggers the error. I added ".NES()" to the NES.Sample.Web and now it works. This is an otherwise unaltered NES sample. So errors I saw after adding the NES configuration earlier does not originate from NES. Thanks! – Werner Sep 19 '11 at 09:31

1 Answers1

0

It looks as if a message is being handled in an endpoint that hasn't been initialised with the .NES() extension.

Elliot Ritchie
  • 417
  • 3
  • 5
  • Yes that was also my conclusion, as the type collection is set when specifying ".NES()". And the failing project is the NES.Sample.Web which is indeed missing that configuration. But the project works using NSB 2.6 so that can't be a correct fix? If I do specify ".NES()" it gives me another exception so I did not turn down that path... – Werner Sep 19 '11 at 06:56
  • Yes, adding ".NES()" to the NSB configuration solves it. Seems that CompletionMessage is handled differently from NSB 2.0->2.5. This is an otherwise unaltered NES sample. So errors I saw after adding the NES configuration earlier, does not originate from NES. Thanks! – Werner Sep 19 '11 at 09:32