Loading ...
Sorry, an error occurred while loading the content.

Bus.Send causing NullReferenceException from GetMachineNameFromLogicalName

Expand Messages
  • dylanbeattie
    Hi, An NServiceBus app I m working on - Galleria - that has been running quite happily for the last few months is being deployed into a new environment, and
    Message 1 of 7 , Jan 12, 2012
    • 0 Attachment
      Hi,

      An NServiceBus app I'm working on - Galleria - that has been running quite happily for the last few months is being deployed into a new environment, and I'm getting the following error:

      Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
      at NServiceBus.Utils.MsmqUtilities.GetMachineNameFromLogicalName(String logicalName) in d:\BuildAgent-02\work\20b5f701adefe8f8\src\utils\MsmqUtilities.cs:line 106
      at NServiceBus.Utils.MsmqUtilities.GetFullPath(String value) in d:\BuildAgent-02\work\20b5f701adefe8f8\src\utils\MsmqUtilities.cs:line 78
      at NServiceBus.Unicast.Transport.Msmq.MsmqTransport.Send(TransportMessage m, String destination) in d:\BuildAgent-02\work\20b5f701adefe8f8\src\impl\unicast\NServiceBus.Unicast.Msmq\MsmqTransport.cs:line 294
      at NServiceBus.Unicast.UnicastBus.SendMessage(IEnumerable`1 destinations, String correlationId, MessageIntentEnum messageIntent, IMessage[] messages) in d:\BuildAgent-02\work\20b5f701adefe8f8\src\unicast\NServiceBus.Unicast\UnicastBus.cs:line 591
      at NServiceBus.Unicast.UnicastBus.Publish[T](T[] messages) in d:\BuildAgent-02\work\20b5f701adefe8f8\src\unicast\NServiceBus.Unicast\UnicastBus.cs:line 343
      at Galleria.Notifier.NotificationPublisher.MonitorFileChanged(Object sender, FileSystemEventArgs args)
      at System.IO.FileSystemEventHandler.Invoke(Object sender, FileSystemEventArgs e)
      at Galleria.Notifier.Concrete.FileSystemMonitor.OnChange(Object sender, FileSystemEventArgs args)
      at System.IO.FileSystemWatcher.CompletionStatusChanged(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* overlappedPointer)
      at System.Threading.ExecutionContext.runTryCode(Object userData) 
      at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)  
      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

      The app doesn't subscribe to any messages, it only sends them, and the same code seems to be working reliably in other environments. This is with NServiceBus 2.5.0.1446, and happens whether the app is running as a Windows service or directly from the command line, and I'm stumped - I haven't seen this error before and I'm not sure how to resolve it.

      Any ideas?

      Thanks,

      Dylan



    • Werner
      When you Bus.Send you specify a destination (string). Double check that your destination isn t null. -- Werner
      Message 2 of 7 , Jan 13, 2012
      • 0 Attachment
        When you Bus.Send you specify a destination (string). Double check that your destination isn't null.

        --
        Werner


        --- In nservicebus@yahoogroups.com, "dylanbeattie" <dylan@...> wrote:
        >
        > Hi,
        > An NServiceBus app I'm working on - Galleria - that has been running
        > quite happily for the last few months is being deployed into a new
        > environment, and I'm getting the following error:
        > Unhandled Exception: System.NullReferenceException: Object reference not
        > set to an instance of an object.at
        > NServiceBus.Utils.MsmqUtilities.GetMachineNameFromLogicalName(String
        > logicalName) in
        > d:\BuildAgent-02\work\20b5f701adefe8f8\src\utils\MsmqUtilities.cs:line
        > 106at NServiceBus.Utils.MsmqUtilities.GetFullPath(String value) in
        > d:\BuildAgent-02\work\20b5f701adefe8f8\src\utils\MsmqUtilities.cs:line
        > 78at
        > NServiceBus.Unicast.Transport.Msmq.MsmqTransport.Send(TransportMessage
        > m, String destination) in
        > d:\BuildAgent-02\work\20b5f701adefe8f8\src\impl\unicast\NServiceBus.Unic\
        > ast.Msmq\MsmqTransport.cs:line 294at
        > NServiceBus.Unicast.UnicastBus.SendMessage(IEnumerable`1 destinations,
        > String correlationId, MessageIntentEnum messageIntent, IMessage[]
        > messages) in
        > d:\BuildAgent-02\work\20b5f701adefe8f8\src\unicast\NServiceBus.Unicast\U\
        > nicastBus.cs:line 591at NServiceBus.Unicast.UnicastBus.Publish[T](T[]
        > messages) in
        > d:\BuildAgent-02\work\20b5f701adefe8f8\src\unicast\NServiceBus.Unicast\U\
        > nicastBus.cs:line 343at
        > Galleria.Notifier.NotificationPublisher.MonitorFileChanged(Object
        > sender, FileSystemEventArgs args)at
        > System.IO.FileSystemEventHandler.Invoke(Object sender,
        > FileSystemEventArgs e)at
        > Galleria.Notifier.Concrete.FileSystemMonitor.OnChange(Object sender,
        > FileSystemEventArgs args)at
        > System.IO.FileSystemWatcher.CompletionStatusChanged(UInt32 errorCode,
        > UInt32 numBytes, NativeOverlapped* overlappedPointer)at
        > System.Threading.ExecutionContext.runTryCode(Object userData) at
        > System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteed\
        > Cleanup(TryCode code, CleanupCode backoutCode, Object userData) at
        > System.Threading.ExecutionContext.Run(ExecutionContext executionContext,
        > ContextCallback callback, Object state)at
        > System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt3\
        > 2 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
        > The app doesn't subscribe to any messages, it only sends them, and the
        > same code seems to be working reliably in other environments. This is
        > with NServiceBus 2.5.0.1446, and happens whether the app is running as a
        > Windows service or directly from the command line, and I'm stumped - I
        > haven't seen this error before and I'm not sure how to resolve it.
        > Any ideas?
        > Thanks,
        > Dylan
        >
      • Werner
        ...or config is missing for that messagetype. Depends on how you send your message. -- Werner
        Message 3 of 7 , Jan 13, 2012
        • 0 Attachment
          ...or config is missing for that messagetype. Depends on how you send your message.

          --
          Werner


          --- In nservicebus@yahoogroups.com, "Werner" <itemplate@...> wrote:
          >
          >
          > When you Bus.Send you specify a destination (string). Double check that your destination isn't null.
          >
          > --
          > Werner
          >
          >
          > --- In nservicebus@yahoogroups.com, "dylanbeattie" <dylan@> wrote:
          > >
          > > Hi,
          > > An NServiceBus app I'm working on - Galleria - that has been running
          > > quite happily for the last few months is being deployed into a new
          > > environment, and I'm getting the following error:
          > > Unhandled Exception: System.NullReferenceException: Object reference not
          > > set to an instance of an object.at
          > > NServiceBus.Utils.MsmqUtilities.GetMachineNameFromLogicalName(String
          > > logicalName) in
          > > d:\BuildAgent-02\work\20b5f701adefe8f8\src\utils\MsmqUtilities.cs:line
          > > 106at NServiceBus.Utils.MsmqUtilities.GetFullPath(String value) in
          > > d:\BuildAgent-02\work\20b5f701adefe8f8\src\utils\MsmqUtilities.cs:line
          > > 78at
          > > NServiceBus.Unicast.Transport.Msmq.MsmqTransport.Send(TransportMessage
          > > m, String destination) in
          > > d:\BuildAgent-02\work\20b5f701adefe8f8\src\impl\unicast\NServiceBus.Unic\
          > > ast.Msmq\MsmqTransport.cs:line 294at
          > > NServiceBus.Unicast.UnicastBus.SendMessage(IEnumerable`1 destinations,
          > > String correlationId, MessageIntentEnum messageIntent, IMessage[]
          > > messages) in
          > > d:\BuildAgent-02\work\20b5f701adefe8f8\src\unicast\NServiceBus.Unicast\U\
          > > nicastBus.cs:line 591at NServiceBus.Unicast.UnicastBus.Publish[T](T[]
          > > messages) in
          > > d:\BuildAgent-02\work\20b5f701adefe8f8\src\unicast\NServiceBus.Unicast\U\
          > > nicastBus.cs:line 343at
          > > Galleria.Notifier.NotificationPublisher.MonitorFileChanged(Object
          > > sender, FileSystemEventArgs args)at
          > > System.IO.FileSystemEventHandler.Invoke(Object sender,
          > > FileSystemEventArgs e)at
          > > Galleria.Notifier.Concrete.FileSystemMonitor.OnChange(Object sender,
          > > FileSystemEventArgs args)at
          > > System.IO.FileSystemWatcher.CompletionStatusChanged(UInt32 errorCode,
          > > UInt32 numBytes, NativeOverlapped* overlappedPointer)at
          > > System.Threading.ExecutionContext.runTryCode(Object userData) at
          > > System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteed\
          > > Cleanup(TryCode code, CleanupCode backoutCode, Object userData) at
          > > System.Threading.ExecutionContext.Run(ExecutionContext executionContext,
          > > ContextCallback callback, Object state)at
          > > System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt3\
          > > 2 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
          > > The app doesn't subscribe to any messages, it only sends them, and the
          > > same code seems to be working reliably in other environments. This is
          > > with NServiceBus 2.5.0.1446, and happens whether the app is running as a
          > > Windows service or directly from the command line, and I'm stumped - I
          > > haven't seen this error before and I'm not sure how to resolve it.
          > > Any ideas?
          > > Thanks,
          > > Dylan
          > >
          >
        • Dylan Beattie
          My mistake - the line that s erroring is actually bus.Publish(), not bus.Send() - and as I said, the same code is running elsewhere without problems so I m
          Message 4 of 7 , Jan 13, 2012
          • 0 Attachment
            My mistake - the line that's erroring is actually bus.Publish(), not bus.Send() - and as I said, the same code is running elsewhere without problems so I'm wondering whether it's a configuration/environment problem...

            Thanks,

            -D-

            On 13 January 2012 10:14, Werner <itemplate@...> wrote:
             


            ...or config is missing for that messagetype. Depends on how you send your message.

            --
            Werner



            --- In nservicebus@yahoogroups.com, "Werner" <itemplate@...> wrote:
            >
            >
            > When you Bus.Send you specify a destination (string). Double check that your destination isn't null.
            >
            > --
            > Werner
            >
            >
            > --- In nservicebus@yahoogroups.com, "dylanbeattie" <dylan@> wrote:
            > >
            > > Hi,
            > > An NServiceBus app I'm working on - Galleria - that has been running
            > > quite happily for the last few months is being deployed into a new
            > > environment, and I'm getting the following error:
            > > Unhandled Exception: System.NullReferenceException: Object reference not
            > > set to an instance of an object.at
            > > NServiceBus.Utils.MsmqUtilities.GetMachineNameFromLogicalName(String
            > > logicalName) in
            > > d:\BuildAgent-02\work\20b5f701adefe8f8\src\utils\MsmqUtilities.cs:line
            > > 106at NServiceBus.Utils.MsmqUtilities.GetFullPath(String value) in
            > > d:\BuildAgent-02\work\20b5f701adefe8f8\src\utils\MsmqUtilities.cs:line
            > > 78at
            > > NServiceBus.Unicast.Transport.Msmq.MsmqTransport.Send(TransportMessage
            > > m, String destination) in
            > > d:\BuildAgent-02\work\20b5f701adefe8f8\src\impl\unicast\NServiceBus.Unic\
            > > ast.Msmq\MsmqTransport.cs:line 294at
            > > NServiceBus.Unicast.UnicastBus.SendMessage(IEnumerable`1 destinations,
            > > String correlationId, MessageIntentEnum messageIntent, IMessage[]
            > > messages) in
            > > d:\BuildAgent-02\work\20b5f701adefe8f8\src\unicast\NServiceBus.Unicast\U\
            > > nicastBus.cs:line 591at NServiceBus.Unicast.UnicastBus.Publish[T](T[]
            > > messages) in
            > > d:\BuildAgent-02\work\20b5f701adefe8f8\src\unicast\NServiceBus.Unicast\U\
            > > nicastBus.cs:line 343at
            > > Galleria.Notifier.NotificationPublisher.MonitorFileChanged(Object
            > > sender, FileSystemEventArgs args)at
            > > System.IO.FileSystemEventHandler.Invoke(Object sender,
            > > FileSystemEventArgs e)at
            > > Galleria.Notifier.Concrete.FileSystemMonitor.OnChange(Object sender,
            > > FileSystemEventArgs args)at
            > > System.IO.FileSystemWatcher.CompletionStatusChanged(UInt32 errorCode,
            > > UInt32 numBytes, NativeOverlapped* overlappedPointer)at
            > > System.Threading.ExecutionContext.runTryCode(Object userData) at
            > > System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteed\
            > > Cleanup(TryCode code, CleanupCode backoutCode, Object userData) at
            > > System.Threading.ExecutionContext.Run(ExecutionContext executionContext,
            > > ContextCallback callback, Object state)at
            > > System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt3\
            > > 2 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
            > > The app doesn't subscribe to any messages, it only sends them, and the
            > > same code seems to be working reliably in other environments. This is
            > > with NServiceBus 2.5.0.1446, and happens whether the app is running as a
            > > Windows service or directly from the command line, and I'm stumped - I
            > > haven't seen this error before and I'm not sure how to resolve it.
            > > Any ideas?
            > > Thanks,
            > > Dylan
            > >
            >


          • Werner
            Yes, your stack even shows that, however behind NSb does a Send using MsmqTransport. I d still say double check that the configuration is correct for the
            Message 5 of 7 , Jan 13, 2012
            • 0 Attachment
              Yes, your stack even shows that, however behind NSb does a "Send" using MsmqTransport. I'd still say double check that the configuration is correct for the message you are sending (Unicast config). I dont have 2.5 code, but the 2.0 code would produce that exception if the destination string (here subscriber) is null.

              --
              Werner


              --- In nservicebus@yahoogroups.com, Dylan Beattie <dylan@...> wrote:
              >
              > My mistake - the line that's erroring is actually bus.Publish(), not
              > bus.Send() - and as I said, the same code is running elsewhere without
              > problems so I'm wondering whether it's a configuration/environment
              > problem...
              >
              > Thanks,
              >
              > -D-
              >
              > On 13 January 2012 10:14, Werner <itemplate@...> wrote:
              >
              > > **
              > >
              > >
              > >
              > > ...or config is missing for that messagetype. Depends on how you send your
              > > message.
              > >
              > > --
              > > Werner
              > >
              > >
              > > --- In nservicebus@yahoogroups.com, "Werner" <itemplate@> wrote:
              > > >
              > > >
              > > > When you Bus.Send you specify a destination (string). Double check that
              > > your destination isn't null.
              > > >
              > > > --
              > > > Werner
              > > >
              > > >
              > > > --- In nservicebus@yahoogroups.com, "dylanbeattie" <dylan@> wrote:
              > > > >
              > > > > Hi,
              > > > > An NServiceBus app I'm working on - Galleria - that has been running
              > > > > quite happily for the last few months is being deployed into a new
              > > > > environment, and I'm getting the following error:
              > > > > Unhandled Exception: System.NullReferenceException: Object reference
              > > not
              > > > > set to an instance of an object.at
              > > > > NServiceBus.Utils.MsmqUtilities.GetMachineNameFromLogicalName(String
              > > > > logicalName) in
              > > > > d:\BuildAgent-02\work\20b5f701adefe8f8\src\utils\MsmqUtilities.cs:line
              > > > > 106at NServiceBus.Utils.MsmqUtilities.GetFullPath(String value) in
              > > > > d:\BuildAgent-02\work\20b5f701adefe8f8\src\utils\MsmqUtilities.cs:line
              > > > > 78at
              > > > > NServiceBus.Unicast.Transport.Msmq.MsmqTransport.Send(TransportMessage
              > > > > m, String destination) in
              > > > >
              > > d:\BuildAgent-02\work\20b5f701adefe8f8\src\impl\unicast\NServiceBus.Unic\
              > > > > ast.Msmq\MsmqTransport.cs:line 294at
              > > > > NServiceBus.Unicast.UnicastBus.SendMessage(IEnumerable`1 destinations,
              > > > > String correlationId, MessageIntentEnum messageIntent, IMessage[]
              > > > > messages) in
              > > > >
              > > d:\BuildAgent-02\work\20b5f701adefe8f8\src\unicast\NServiceBus.Unicast\U\
              > > > > nicastBus.cs:line 591at NServiceBus.Unicast.UnicastBus.Publish[T](T[]
              > > > > messages) in
              > > > >
              > > d:\BuildAgent-02\work\20b5f701adefe8f8\src\unicast\NServiceBus.Unicast\U\
              > > > > nicastBus.cs:line 343at
              > > > > Galleria.Notifier.NotificationPublisher.MonitorFileChanged(Object
              > > > > sender, FileSystemEventArgs args)at
              > > > > System.IO.FileSystemEventHandler.Invoke(Object sender,
              > > > > FileSystemEventArgs e)at
              > > > > Galleria.Notifier.Concrete.FileSystemMonitor.OnChange(Object sender,
              > > > > FileSystemEventArgs args)at
              > > > > System.IO.FileSystemWatcher.CompletionStatusChanged(UInt32 errorCode,
              > > > > UInt32 numBytes, NativeOverlapped* overlappedPointer)at
              > > > > System.Threading.ExecutionContext.runTryCode(Object userData) at
              > > > >
              > > System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteed\
              > > > > Cleanup(TryCode code, CleanupCode backoutCode, Object userData) at
              > > > > System.Threading.ExecutionContext.Run(ExecutionContext
              > > executionContext,
              > > > > ContextCallback callback, Object state)at
              > > > >
              > > System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt3\
              > > > > 2 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
              > > > > The app doesn't subscribe to any messages, it only sends them, and the
              > > > > same code seems to be working reliably in other environments. This is
              > > > > with NServiceBus 2.5.0.1446, and happens whether the app is running as
              > > a
              > > > > Windows service or directly from the command line, and I'm stumped - I
              > > > > haven't seen this error before and I'm not sure how to resolve it.
              > > > > Any ideas?
              > > > > Thanks,
              > > > > Dylan
              > > > >
              > > >
              > >
              > >
              > >
              >
            • Dylan Beattie
              OK, digging a little deeper into the NSB source, it appears that in UnicastBus.Publish (), subscriptionStorage.GetSubscribersForMessage() is returning a
              Message 6 of 7 , Jan 13, 2012
              • 0 Attachment
                OK, digging a little deeper into the NSB source, it appears that in UnicastBus.Publish<T>(), subscriptionStorage.GetSubscribersForMessage() is returning a single-element array - which is correct, since I've registered a single subscriber - but that the only element in the array is actually null.

                The call to SendMessage(subscribers, null, MessageIntentEnum.Publish, messages as IMessage[]); is then passing an array containing a single null reference as the subscribers argument, which is then failing whtn MsmqUtilities.GetMachineNameFromLogicalName tries to call logicalName.Split('@')

                Running the publisher with no subscribers works as expected - the subscribers array in this call is empty.

                Running with a single subscriber causes the null-reference exception.

                Running with multiple subscribers causes the same exception - but the subscribers array still only contains a single element - is this correct?

                My understanding was that the destination queue names should be managed by the subscription storage mechanism - if so, what piece of code / configuration have I missed that's causing this unusual behaviour?

                Thanks,

                Dylan






                On 13 January 2012 12:04, Dylan Beattie <dylan@...> wrote:
                My mistake - the line that's erroring is actually bus.Publish(), not bus.Send() - and as I said, the same code is running elsewhere without problems so I'm wondering whether it's a configuration/environment problem...

                Thanks,

                -D-


                On 13 January 2012 10:14, Werner <itemplate@...> wrote:
                 


                ...or config is missing for that messagetype. Depends on how you send your message.

                --
                Werner



                --- In nservicebus@yahoogroups.com, "Werner" <itemplate@...> wrote:
                >
                >
                > When you Bus.Send you specify a destination (string). Double check that your destination isn't null.
                >
                > --
                > Werner
                >
                >
                > --- In nservicebus@yahoogroups.com, "dylanbeattie" <dylan@> wrote:
                > >
                > > Hi,
                > > An NServiceBus app I'm working on - Galleria - that has been running
                > > quite happily for the last few months is being deployed into a new
                > > environment, and I'm getting the following error:
                > > Unhandled Exception: System.NullReferenceException: Object reference not
                > > set to an instance of an object.at
                > > NServiceBus.Utils.MsmqUtilities.GetMachineNameFromLogicalName(String
                > > logicalName) in
                > > d:\BuildAgent-02\work\20b5f701adefe8f8\src\utils\MsmqUtilities.cs:line
                > > 106at NServiceBus.Utils.MsmqUtilities.GetFullPath(String value) in
                > > d:\BuildAgent-02\work\20b5f701adefe8f8\src\utils\MsmqUtilities.cs:line
                > > 78at
                > > NServiceBus.Unicast.Transport.Msmq.MsmqTransport.Send(TransportMessage
                > > m, String destination) in
                > > d:\BuildAgent-02\work\20b5f701adefe8f8\src\impl\unicast\NServiceBus.Unic\
                > > ast.Msmq\MsmqTransport.cs:line 294at
                > > NServiceBus.Unicast.UnicastBus.SendMessage(IEnumerable`1 destinations,
                > > String correlationId, MessageIntentEnum messageIntent, IMessage[]
                > > messages) in
                > > d:\BuildAgent-02\work\20b5f701adefe8f8\src\unicast\NServiceBus.Unicast\U\
                > > nicastBus.cs:line 591at NServiceBus.Unicast.UnicastBus.Publish[T](T[]
                > > messages) in
                > > d:\BuildAgent-02\work\20b5f701adefe8f8\src\unicast\NServiceBus.Unicast\U\
                > > nicastBus.cs:line 343at
                > > Galleria.Notifier.NotificationPublisher.MonitorFileChanged(Object
                > > sender, FileSystemEventArgs args)at
                > > System.IO.FileSystemEventHandler.Invoke(Object sender,
                > > FileSystemEventArgs e)at
                > > Galleria.Notifier.Concrete.FileSystemMonitor.OnChange(Object sender,
                > > FileSystemEventArgs args)at
                > > System.IO.FileSystemWatcher.CompletionStatusChanged(UInt32 errorCode,
                > > UInt32 numBytes, NativeOverlapped* overlappedPointer)at
                > > System.Threading.ExecutionContext.runTryCode(Object userData) at
                > > System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteed\
                > > Cleanup(TryCode code, CleanupCode backoutCode, Object userData) at
                > > System.Threading.ExecutionContext.Run(ExecutionContext executionContext,
                > > ContextCallback callback, Object state)at
                > > System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt3\
                > > 2 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
                > > The app doesn't subscribe to any messages, it only sends them, and the
                > > same code seems to be working reliably in other environments. This is
                > > with NServiceBus 2.5.0.1446, and happens whether the app is running as a
                > > Windows service or directly from the command line, and I'm stumped - I
                > > haven't seen this error before and I'm not sure how to resolve it.
                > > Any ideas?
                > > Thanks,
                > > Dylan
                > >
                >



              • Werner
                Well my understanding is that your understanding is correct :) can you verify that the subsriber storage is actually valid? Look in the DB and check that the
                Message 7 of 7 , Jan 13, 2012
                • 0 Attachment
                  Well my understanding is that your understanding is correct :)

                  can you verify that the subsriber storage is actually valid? Look in the DB and check that the queue values aren't null. If you are running with MSMQ subsribtion check the message details.

                  If you are running in-memory subscription storage try change that to either database or msmq using the profiles

                  Other than that, better wait until Udi or Andreas spots your post.

                  --
                  Werner



                  --- In nservicebus@yahoogroups.com, Dylan Beattie <dylan@...> wrote:
                  >
                  > OK, digging a little deeper into the NSB source, it appears that in
                  > UnicastBus.Publish<T>(), subscriptionStorage.GetSubscribersForMessage() is
                  > returning a single-element array - which is correct, since I've registered
                  > a single subscriber - but that the only element in the array is actually
                  > null.
                  >
                  > The call to SendMessage(subscribers, null, MessageIntentEnum.Publish,
                  > messages as IMessage[]); is then passing an array containing a single null
                  > reference as the subscribers argument, which is then failing whtn
                  > MsmqUtilities.GetMachineNameFromLogicalName tries to call
                  > logicalName.Split('@')
                  >
                  > Running the publisher with no subscribers works as expected - the
                  > subscribers array in this call is empty.
                  >
                  > Running with a single subscriber causes the null-reference exception.
                  >
                  > Running with multiple subscribers causes the same exception - but the
                  > subscribers array still only contains a single element - is this correct?
                  >
                  > My understanding was that the destination queue names should be managed by
                  > the subscription storage mechanism - if so, what piece of code /
                  > configuration have I missed that's causing this unusual behaviour?
                  >
                  > Thanks,
                  >
                  > Dylan
                  >
                  >
                  >
                  >
                  >
                  >
                  > On 13 January 2012 12:04, Dylan Beattie <dylan@...> wrote:
                  >
                  > > My mistake - the line that's erroring is actually bus.Publish(), not
                  > > bus.Send() - and as I said, the same code is running elsewhere without
                  > > problems so I'm wondering whether it's a configuration/environment
                  > > problem...
                  > >
                  > > Thanks,
                  > >
                  > > -D-
                  > >
                  > >
                  > > On 13 January 2012 10:14, Werner <itemplate@...> wrote:
                  > >
                  > >> **
                  > >>
                  > >>
                  > >>
                  > >> ...or config is missing for that messagetype. Depends on how you send
                  > >> your message.
                  > >>
                  > >> --
                  > >> Werner
                  > >>
                  > >>
                  > >> --- In nservicebus@yahoogroups.com, "Werner" <itemplate@> wrote:
                  > >> >
                  > >> >
                  > >> > When you Bus.Send you specify a destination (string). Double check that
                  > >> your destination isn't null.
                  > >> >
                  > >> > --
                  > >> > Werner
                  > >> >
                  > >> >
                  > >> > --- In nservicebus@yahoogroups.com, "dylanbeattie" <dylan@> wrote:
                  > >> > >
                  > >> > > Hi,
                  > >> > > An NServiceBus app I'm working on - Galleria - that has been running
                  > >> > > quite happily for the last few months is being deployed into a new
                  > >> > > environment, and I'm getting the following error:
                  > >> > > Unhandled Exception: System.NullReferenceException: Object reference
                  > >> not
                  > >> > > set to an instance of an object.at
                  > >> > > NServiceBus.Utils.MsmqUtilities.GetMachineNameFromLogicalName(String
                  > >> > > logicalName) in
                  > >> > > d:\BuildAgent-02\work\20b5f701adefe8f8\src\utils\MsmqUtilities.cs:line
                  > >> > > 106at NServiceBus.Utils.MsmqUtilities.GetFullPath(String value) in
                  > >> > > d:\BuildAgent-02\work\20b5f701adefe8f8\src\utils\MsmqUtilities.cs:line
                  > >> > > 78at
                  > >> > > NServiceBus.Unicast.Transport.Msmq.MsmqTransport.Send(TransportMessage
                  > >> > > m, String destination) in
                  > >> > >
                  > >> d:\BuildAgent-02\work\20b5f701adefe8f8\src\impl\unicast\NServiceBus.Unic\
                  > >> > > ast.Msmq\MsmqTransport.cs:line 294at
                  > >> > > NServiceBus.Unicast.UnicastBus.SendMessage(IEnumerable`1 destinations,
                  > >> > > String correlationId, MessageIntentEnum messageIntent, IMessage[]
                  > >> > > messages) in
                  > >> > >
                  > >> d:\BuildAgent-02\work\20b5f701adefe8f8\src\unicast\NServiceBus.Unicast\U\
                  > >> > > nicastBus.cs:line 591at NServiceBus.Unicast.UnicastBus.Publish[T](T[]
                  > >> > > messages) in
                  > >> > >
                  > >> d:\BuildAgent-02\work\20b5f701adefe8f8\src\unicast\NServiceBus.Unicast\U\
                  > >> > > nicastBus.cs:line 343at
                  > >> > > Galleria.Notifier.NotificationPublisher.MonitorFileChanged(Object
                  > >> > > sender, FileSystemEventArgs args)at
                  > >> > > System.IO.FileSystemEventHandler.Invoke(Object sender,
                  > >> > > FileSystemEventArgs e)at
                  > >> > > Galleria.Notifier.Concrete.FileSystemMonitor.OnChange(Object sender,
                  > >> > > FileSystemEventArgs args)at
                  > >> > > System.IO.FileSystemWatcher.CompletionStatusChanged(UInt32 errorCode,
                  > >> > > UInt32 numBytes, NativeOverlapped* overlappedPointer)at
                  > >> > > System.Threading.ExecutionContext.runTryCode(Object userData) at
                  > >> > >
                  > >> System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteed\
                  > >> > > Cleanup(TryCode code, CleanupCode backoutCode, Object userData) at
                  > >> > > System.Threading.ExecutionContext.Run(ExecutionContext
                  > >> executionContext,
                  > >> > > ContextCallback callback, Object state)at
                  > >> > >
                  > >> System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt3\
                  > >> > > 2 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
                  > >> > > The app doesn't subscribe to any messages, it only sends them, and the
                  > >> > > same code seems to be working reliably in other environments. This is
                  > >> > > with NServiceBus 2.5.0.1446, and happens whether the app is running
                  > >> as a
                  > >> > > Windows service or directly from the command line, and I'm stumped - I
                  > >> > > haven't seen this error before and I'm not sure how to resolve it.
                  > >> > > Any ideas?
                  > >> > > Thanks,
                  > >> > > Dylan
                  > >> > >
                  > >> >
                  > >>
                  > >>
                  > >>
                  > >
                  > >
                  >
                Your message has been successfully submitted and would be delivered to recipients shortly.