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

MqttClientOptionsBuilder.WithTcpServer System.ArgumentException: No endpoint is set #2034

Open
ramonsmits opened this issue Jul 6, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@ramonsmits
Copy link
Contributor

Describe the bug

The MqttClientOptionsBuilder using WithTcpServer fails with the message "No endpoint is set" while RemoteEndpoint is assigned.

System.ArgumentException: No endpoint is set.
  at MQTTnet.Client.MqttClientOptionsBuilder.Build()
var options = new MqttClientOptionsBuilder()
    .WithTcpServer(s =>
    {
        s.AddressFamily = System.Net.Sockets.AddressFamily.InterNetwork;
        s.RemoteEndpoint = new DnsEndPoint(Server.Host, Server.Port);
    })
	.Build();

Doing the following works:

var options = new MqttClientOptionsBuilder()
    .WithEndPoint(new DnsEndPoint(Server.Host, Server.Port,System.Net.Sockets.AddressFamily.InterNetwork))
	.Build();

I'm not sure on the differences between these API's but I think WithTcpServer should be able to be used without WithEndPoint.

Maybe WithTcpServer is obsolete?

Which component is your bug related to?

  • Client

To Reproduce

Steps to reproduce the behavior:

  1. Using this version of MQTTnet 4.3.6.1152
  2. Run this code, see above
  3. With these arguments, see above
  4. See error, see above

Expected behavior

Builder to succeed.

@ramonsmits ramonsmits added the bug Something isn't working label Jul 6, 2024
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

No branches or pull requests

1 participant