Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Payload format indicator contains always "UNSPECIFIED" value after publishing #108

Closed
dalbarracin opened this issue Nov 7, 2023 · 4 comments · Fixed by #109
Closed

Payload format indicator contains always "UNSPECIFIED" value after publishing #108

dalbarracin opened this issue Nov 7, 2023 · 4 comments · Fixed by #109
Labels
bug Something isn't working

Comments

@dalbarracin
Copy link

dalbarracin commented Nov 7, 2023

Hello guys :)

Here some reports regarding bugs found so far when publishing messages using c# client library.

🐛 Bug Report

A published message with PayloadFormatIndicator = UTF8Encoded is always sent with Unspecified. When a Validate() method is called, it is always being set to Unspecified when contains both values. This is wrong, it should only throw an exception if it contains a different value, Unspecified if it is nullalble or keep the current value.

🔬 How To Reproduce

Steps to reproduce the behavior:

  1. Define a client of type HiveMQClient with a specific options for your configuration.
  2. Create a event handler for client.OnPublishSent event and assign to it. The event handler should print a value from OnPublishSentEventArgs.PublishPacket.Message.PayloadFormatIndicator.
  3. Create an instance of MQTT5PublishMessage and set a value as PayloadFormatIndicator = MQTT5PayloadFormatIndicator.UTF8Encoded.
  4. Finally publish the message defined in step 3 as await client.PublishAync(message).ConfigureAwait(false)

Code Example

The code in discussion can be found here

Environment

The client is ran in Windows 10 OS with dotnet 6 sdk and HiveMQTT v0.5.0 C# nuget package.

📈 Expected behavior

The value of the PayloadFormatIndicator should be the one it is set before publishing.

@dalbarracin dalbarracin added the bug Something isn't working label Nov 7, 2023
Copy link

github-actions bot commented Nov 7, 2023

Hello @dalbarracin, thanks for contributing to the HiveMQ community! We will respond as soon as possible.

@pglombardo
Copy link
Collaborator

Doh! Great find @dalbarracin - I'll fix that up soon. Thanks for reporting!

@dalbarracin dalbarracin changed the title Payload format indicator contains always "UNESPECIFIED" value after publishing Payload format indicator contains always "UNSPECIFIED" value after publishing Nov 7, 2023
@pglombardo
Copy link
Collaborator

The fix for this has been added in release 0.6.0 which is building now and should be on NuGet soon. Thanks for pointing this out @dalbarracin!

@dalbarracin
Copy link
Author

Thank you @pglombardo for taking your time on this. NIcely done :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants