I have found the issue:

Basically, for whatever reason, I had a localhost installed on my LocalComputer
store certificates. This made me think that Visual Studio created it, in reality VS creates certificates in the CurrentUser
store, as visible by the open code in the dotnet repo.
Typically the procedure, for generating and TLS certificate by VS, is expected to go as such:
A .NET Project is marked as HTTPS, and you try to run it.
VS checks if a certificate is present in the CurrentUser
store, asks to create one if it's not
User clicks YES, to creating a certificate, initially the certificate is installed in the CurrentUser/Personal/Certificates store
VS then sees that you do not have a localhost certificate in CurrentUser/TrustedRootCA/Certificates
, and makes a prompt to ask you if you would like to install one, you click YES - everything is done.
Now if for some reason you are like me... and your CurrentUser/Trusted Root Certification Authority/Certificates
is read only. Then you end up on the following line of the code:
case EnsureCertificateResult.FailedToTrustTheCertificate:
reporter.Warn("There was an error trusting HTTPS developer certificate.");
Because well step 4 failed...
To mitigate this:
- Open the
CurrentUser
and LocalComputer
stores. You can do that by following this microsoft guide, or just type certlm.msc
and certmgr.msc
in the Start.
- Right click Export on the localhost certificate in
CurrentUser
store and export it as with the default options
- Try importing the same certificate in the Trusted Root Certification Authorities/Certificates folder of the
CurrentUser
store.
- If step 3 failed,which it should have because you wouldn't be in this predicament otherwise, import your certificate in the Trusted Root Certification Authorities/Certificates folder of the
LocalComputer
store.
Now everything should work. Hopefully you wouldn't have spent 6 hours on this, like I did.