Using existing unitycontainer and getting object disposed error for UnityObjectBuilder nServiceBus 5.0.11

nservicebus

(Akshay Chauhan) #1

Hi,
We are facing object disposed error after upgrading nServiceBus v5
Here is what we have upgraded to:

•we are including: ◦NServiceBus.Unity 6.1.2
◦NServiceBus 5.0.11
◦Unity 3.5.1401.0

We have two problems after upgrading to above spec:

  1. What we used to do in earlier version was in Saga class we used have property injection for IUnityContainer and that used to work before, here is the example.
    public class LmmValidationSaga : Sagag, IAmStartedByMessages
    {
    public IUnityContainer Container { get;set; }
    public IManageQueries QueryManager { get;set; }

       public void Handle(LmmValidationRequest message)
       {
       }
    

}

above sample code used to resolve “Container” in earlier version of nServiceBus and nServiceBus.Unity but now “Container” object is coming null always.

  1. To do workaround for issue 1 we created constructor for LmmValidationSage and passed IUnityContainer as construction injection and that seems to be working. But doing it that way we are getting another issue which is “object disposed error for UnityObjectBuilder”.

I have found simillar topic in discussion for where you have fixed this issue but it is not the same nServiceBus we are using so that is why i am creating new topic here.

Can you please help us to resolve the issue?

Regards,
Chauhan


(Daniel Marbach) #2

Hi Chauhan,

Would it be possible for you to update to the latest v5 version of NServiceBus and the latest v6 version of the Unit Container and then verify if the problem still occurs? We fixed a few things around the container handling in the latest minors.

Regards
Daniel


(Daniel Marbach) #3

Hi Chauhan

Have you been able to resolve the issue?

Regards
Daniel


(Akshay Chauhan) #4

Hi Daniel,
sorry for late response. But we are still facing the same issue. Upgrading nServiceBus to version 6 is one of the option but it is not that easy in our solutions. It is in our pipeline but not sure when that is going to happen. So it will be good if we get some work around or fix on this version.


(Bob Langley) #5

Chauhan

Upgrade NServicebus.Unity to version 6.2.3. We resolved the property injection and object disposed errors you are experiencing.

  • Bob