paolosalvatori / ServiceBusExplorer

The Service Bus Explorer allows users to connect to a Service Bus namespace and administer messaging entities in an easy manner. The tool provides advanced features like import/export functionality or the ability to test topic, queues, subscriptions, relay services, notification hubs and events hubs.
MIT License
2.02k stars 588 forks source link

Send Message Exception: Could not load type 'Microsoft.ServiceBus.Messaging.MessagingEntityClient' #796

Open alenroki opened 4 months ago

alenroki commented 4 months ago

On a new computer where I am downloading Azure Service Bus Explorer ver. 6.0.2 for the first time, I connect to my Service Bus just fine, but when I try to send a message to my queue, I get this exception:

Exception: Could not load type 'Microsoft.ServiceBus.Messaging.MessagingEntityClient' from assembly 'Microsoft.ServiceBus, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

In my GAC I have the following:

gacutil /l Microsoft.ServiceBus:
Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.0
Copyright (c) Microsoft Corporation.  All rights reserved.

The Global Assembly Cache contains the following assemblies:
  Microsoft.ServiceBus, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL

Number of items = 1

In the folder where Service Bus is unzipped the Microsoft.ServiceBus.dll does exist as well but with this version: 3.0.52723.2

This error with this DLL I have experienced on every single machine since version 4.0.

ErikMogensen commented 4 months ago

It is unfortunate that the version part of the strong name of the Microsoft.ServiceBus assembly is not incremented when they are releasing incompatible versions.

The best thing is if you can remove it from the GAC. If that is not possible you can try a couple of workarounds:

  1. Use DEVPATH. If this works, you can have a script that sets it and then launches SBE.

  2. Overwrite the Microsoft.ServiceBus assembly in the GAC with a new version. It may be locked by Windows Installer. If that's the case uninstall the other application and put the latest Microsoft.ServiceBus in the GAC and then reinstall the other application. However, if newer versions of Microsoft.ServiceBus are released you may have to do this procedure again.

ErikMogensen commented 3 months ago

@alenroki, did you get it working?

alenroki commented 3 months ago

It only works if I take the Microsoft.ServiceBus.dll that came in the package for ServiceBus Explorer and replace the existing one in the DAC. This has been a problem on every new machine I've installed this tool on. I would have hoped that by increasing releases this issues would have been fixed. I didn't know how to configure DEVPATH as you mentioned. Couldn't find examples of it.