rabbitmq-dotnet-client icon indicating copy to clipboard operation
rabbitmq-dotnet-client copied to clipboard

NullReferenceException when setting null Uri into ConnectionFactory

Open lechu445 opened this issue 1 year ago • 2 comments

Describe the bug

It is not clear if ConnectionFactory can have null Uri property. If ConnectionFactory is created via constructor, Uri property returns null. But, ConnectionFactory does not allow explicit set null Uri.

Reproduction steps

Simple reproduction:

using RabbitMQ.Client;

var c = new ConnectionFactory();

Console.WriteLine(c.Uri == null); // prints True

c.Uri = null; // throws NullReferenceException

Expected behavior

NullReferenceException is not thrown.

Additional context

This issue was detected by Roslyn analyzer during work on https://github.com/rabbitmq/rabbitmq-dotnet-client/issues/1596.

lechu445 avatar Jun 28 '24 18:06 lechu445