How do I get the full Url including port for an IPublishedContent

Having obtained a node as IPublishedContent, I want to get the full Url of it.

I tried homePage.Url() but that only gives me “https://localhost/” but the site is running (via Visual Studio) at “https://localhost:44311/

How do I get the full path including the port?

Edit:

Both of these fail to return the Port (they all return “https://localhost/”):

var x = _publishedUrlProvider.GetUrl(homePage, UrlMode.Absolute);
var y = homePage.Url(mode: UrlMode.Absolute)

Also tried

var z = new Uri(homePage.Url(mode: UrlMode.Absolute), UriKind.Absolute);

This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/109094-how-do-i-get-the-full-url-including-port-for-an-ipublishedcontent