aspire icon indicating copy to clipboard operation
aspire copied to clipboard

Endpoints registered as UDP show as TCP

Open cecilphillip opened this issue 1 year ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Describe the bug

When adding a UDP endpoint to a resource, the URI scheme is set to TCP

.WithEndpoint(ConsulResource.DnsEndpointName, ea =>
 {
  ea.Protocol = ProtocolType.Udp;
  ea.Port = dnsPort ;
  ea.TargetPort = ConsulResource.DefaultDnsPort;
})

Steps To Reproduce

Run the code above and inspect the annotations collection for the resource

Screenshot 2024-09-28 at 4 58 24 PM

Exceptions (if any)

No response

.NET Version info

  • .NET Aspire version 8.2.1

Anything else?

No response

cecilphillip avatar Sep 28 '24 21:09 cecilphillip

Seems like a simple issue with how we infer the scheme from the transport and protocol.

DamianEdwards avatar Oct 03 '24 23:10 DamianEdwards

This is not actually a bug. The overload of WithEndpoint which is being used here is the callback variant which is designed to be used to get at every individual property of the endpoint. The EndpointAnnotation does not automatically change the UriScheme of the endpoint if you change the protocol - thats up to the person doing the callback to set everything away from the default (which is TCP).

mitchdenny avatar Oct 04 '24 04:10 mitchdenny