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

When testing in-built Send Event and Create Partition/Consumer Group Listener, message is sent and received yet the message does not appear #720

Closed henryz0113 closed 1 year ago

henryz0113 commented 1 year ago

Hi Guys, Appreciate the work you guys put into the explorer. It really does make life easy. However, I found an issue while testing the in-bult send and listen function to view the message.

[Summary] I tried sending, receiving and reading messages through the built-in function as I wanted to see if the messages are going through fine. The message is sent and received fine but, the issue with reading the messages that was sent. SendEvent image

The functions used within the explorer are Send Event / Create Partition Listener image image

[Issue] The issue appears from 5.0.7, the version I had, and also updated to newest 5.0.15, and the issue is still appearing as well.

When sending the message I can see an Exception returning from the activity log.

Exception : This object is read-only and cannot be modified. This message also appears on the properties of Event System Properties when viewed from the Listener popup console.

error

Also you can Event Custom Properties is blank, where it should have the machine name and the user name.

[TroubleShooting / Validating] I have validated that with version 5.0.3, we are able to send and receive the test message and be able to read the test message sent. image

From this image, you can see that the properties is blank without the exception. As well as, the Event Custom Properties has machine name and user name filled up.

Could you please fix this issue? Thank you in advance.

ErikMogensen commented 1 year ago

That's not good....

I compared the code in 5.0.3 with 5.0.7 and I see that WindowsAzure.ServiceBus was upgraded from 6.0.3 to 6.2.0. Are you able to build the solution? In that case, please downgrade the latest source code to use WindowsAzure.ServiceBus 6.0.3 and test if you can reproduce the issue.

henryz0113 commented 1 year ago

Hi @ErikMogensen I don't know if this is the right way to do it but I've overwritten the Microsoft.ServiceBus.dll from 5.0.3 to the 5.0.15 And I am able to see the messages on the 5.01.15.

However, I am not to sure what are the impacts of changing this. Would this be the correct way to do so?

Thanks

image

ErikMogensen commented 1 year ago

Good that you found the issue. There may be other bugs or missing features in the older version. You can look at the Release notes for the later releases, for instance Release note for WindowsAzure.ServiceBus 6.2.0. I suggest you keep using that version.

The best thing would be if you created a case with Microsoft and asked them to fix the bug. However, I believe they will be reluctant to fix it and instead suggest a switch to the other SDK for Event hubs. But It is not possible to switch ServiceBusExplorer to that SDK since it is lacking support for managing Event hubs using connection strings.

henryz0113 commented 1 year ago

Thanks @ErikMogensen. I'll check with Microsoft on this.

DelS-AGL commented 1 year ago

I have had a similar problem reading Event messages with V-5.0.15 (and every version after V-5.0.4). On advice from @ErikMogensen, I replaced Microsoft.ServiceBus.dll with the version used in V-5.0.4 which has resolved my problem. Thanks.

SeanFeldman commented 1 year ago

I've looked into what's happening, and it appears to be a breaking change with WindowsAzure.ServiceBus. SBE relies on the public API to clone an EventData using EventData.Clone(), but the underlying implementation has been changed, and now the exception is thrown.

System.NotSupportedException: This object is read-only and cannot be modified. at Microsoft.ServiceBus.Common.ReadOnlyDictionary45`2.System.Collections.Generic.IDictionary.set_Item(TKey key, TValue value) in Microsoft.ServiceBus.Common\ReadOnlyDictionary45.cs:line 308 at Microsoft.ServiceBus.Messaging.EventData.UpdateUserPropertiesForReceive() in Microsoft.ServiceBus.Messaging\EventData.cs:line 303 at Microsoft.ServiceBus.Messaging.EventData.Clone() in Microsoft.ServiceBus.Messaging\EventData.cs:line 246 at ServiceBusExplorer.Controls.PartitionListenerControl.eventDataDataGridView_RowEnter(Object sender, DataGridViewCellEventArgs e) in C:\github\SeanFeldman\ServiceBusExplorer\src\ServiceBusExplorer\Controls\PartitionListenerControl.cs:line 647
SeanFeldman commented 1 year ago

This is also the case for the Properties property of EventData.

SeanFeldman commented 1 year ago

Some more analysis of the code path for EventHubs shows that the approach taken for both BrokeredMessage and EventData was storing the original messages in the grid, and whenever a specific one would be selected, it would be cloned for manipulations such as stream and properties reading to populate the selected message UI controls. With the Clone method broken, the implementation doesn't hold and would require reading messages once only, storing some abstraction that would allow "cloning"/working with the event body.

For Properties, I'm not sure what the solution is since SDK is throwing, and we have no access to those.

Properties is working fine.

SeanFeldman commented 1 year ago

@henryz0113, a potential workaround w/o downgrading the SDK is coming.

henryz0113 commented 1 year ago

Hey @SeanFeldman thank you for the update! 💯

SeanFeldman commented 1 year ago

@henryz0113, you can check out the branch and give it a try. I'm not a frequent EH user to validate SBE change. If you could do that and post your findings, it would help. Thank you.

henryz0113 commented 1 year ago

Hey @SeanFeldman awesome job!! Looking great!

We can pick up every information! @ErikMogensen can you please double check and merge it as well?

image