We cant connect with ServiceClient to a emulator running on anything other than port 443
There is a problem with how the serviceclient and SkipDiscovery is handled.
We have build a emulator for dataverse for aspire however it is currently forced to use port 443 because its not possible to connect to a custom port like https://localhost:43434
The problem is:
When the connectionstring is build from options like this:
Then the skipdiscovery is actually omitted when building connectring string:
https://github.com/microsoft/PowerPlatform-DataverseServiceClient/blob/03fa4d1132c90af9f6c08e581119e7407ca61fa7/src/GeneralTools/DataverseClient/Client/Utils/DynamicCrmConstants.cs#L29
if (options.SkipDiscovery) sbConnectionString.Append($"SkipDiscovery={options.SkipDiscovery};");
and then for connecting its parsing the generated connection string where it defaults back to true due to logic.
https://github.com/microsoft/PowerPlatform-DataverseServiceClient/blob/03fa4d1132c90af9f6c08e581119e7407ca61fa7/src/GeneralTools/DataverseClient/Client/Utils/DataverseConnectionStringProcessor.cs#L235
var parsedConnStr = DataverseConnectionStringProcessor.Parse(connectionString, logger);
https://github.com/microsoft/PowerPlatform-DataverseServiceClient/blob/master/src/GeneralTools/DataverseClient/Client/ServiceClient.cs#L992C33-L992C67
which ultimately ends up in this exeception path:
Using a self made connection string results in another exception where it tries to get instance name and fails due to localhost:
So currently there is no happy path to actually connect to a emulator we build unless running it on port 443 directly.