question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] No installed instance of Visual Studio

See original GitHub issue

Describe the bug While running code inside Visual Studio debugger, We basically do: image

then the code look like this (will edit code snippet tomorrow)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Security.Authentication;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Core.Pipeline;
using Azure.Identity;
using Azure.Extensions.AspNetCore.Configuration.Secrets;
using Azure.Security.KeyVault.Secrets;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Azure;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace AzureKeyVault
{
    public class Program
    {
        public static void Main(string[] args)
        {
            CreateHostBuilder(args).Build().Run();
        }

        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .ConfigureAppConfiguration(builder =>
                {
                    var proxyUri = new Uri("http://THE_PROXY:443");

                    var webProxy = new WebProxy
                    {
                        Address = proxyUri,
                        BypassProxyOnLocal = true,
                        Credentials = CredentialCache.DefaultNetworkCredentials,
                    };

                    var httpClientHandler = new HttpClientHandler()
                    {
                        SslProtocols = SslProtocols.Tls13 | SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls,
                        UseProxy = true,
                        Proxy = webProxy
                    };
                    var httpClient = new HttpClient(httpClientHandler);

                    var azCredentialOptions = new DefaultAzureCredentialOptions();
                    azCredentialOptions.Transport = new HttpClientTransport(httpClient);
                    azCredentialOptions.ExcludeAzureCliCredential = true;
                    azCredentialOptions.ExcludeEnvironmentCredential = true;
                    azCredentialOptions.ExcludeInteractiveBrowserCredential = true;
                    azCredentialOptions.ExcludeManagedIdentityCredential = true;
                    azCredentialOptions.ExcludeSharedTokenCacheCredential = true;
                    azCredentialOptions.ExcludeVisualStudioCredential = false;
                    azCredentialOptions.ExcludeVisualStudioCodeCredential = true;

                    var kvUri = new Uri("https://YOUR_KV.vault.azure.net");

                    var secretClient = new SecretClient(kvUri, new DefaultAzureCredential(azCredentialOptions), new SecretClientOptions { Transport = new HttpClientTransport(httpClient) });

                    builder.AddAzureKeyVault(secretClient, new KeyVaultSecretManager());

                })
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder.UseStartup<Startup>();
                });
    }
}

image

We have both a Proxy + 2FA <=== that 2FA is probably a source of issue about this Re enter creds

Expected behavior Properly indicate that the issue is in Tools > Azure Service Authentication > ... It would be amazing if it could say the account that was detected, and that sometime Reenter Credentials is needed image

Actual behavior (include Exception or Stack Trace) Missleading “installation not detected” not giving any leads toward Tools > ....

To Reproduce ==> It worked with 16.8 preview 3.0, beware not to try to repro with it but i could not tell if my account was properly added or not

Steps to reproduce the behavior (include a code snippet, screenshot, or any additional information that might help us reproduce the issue)

  1. Remove all account
  2. Try to connect using the VSCredentials

Environment:

  • Name and version of the Library package used: all latest possible version version, we tried stable and preview (eg: Azure.Identity 1.3.0-beta1 )
  • Hosting platform or OS and .NET runtime version (dotnet --info output for .NET Core projects): all Windows 10 and netcoreapp3.1
  • IDE and version : we tried : Visual Studio 16.6.x Visual Studio 16.3.x Visual Studio 16.7.x all impacted mine was on 16.8 preview 3.0 / no error, I

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
christothescommented, Feb 11, 2021

Thanks - I will close unless you run into this again.

0reactions
tebecocommented, Feb 11, 2021

perfect

Read more comments on GitHub >

github_iconTop Results From Across the Web

CMake: Visual Studio 15 2017 could not find any instance ...
Open Visual Studio · Go to Tools -> Get Tools and Features · In the "Workloads" tab enable "Desktop development with C++" ·...
Read more >
visual studio installer can't see installed instance
Trying to add a component. When I launch visual studio installer, in “Installed”, say "You haven't installed anything yet.
Read more >
could not find any instance of Visual Studio. (solved) #3472
Problem Compiling on windows returns "could not find any instance of Visual Studio" What I did I followed instructions, downloading visual ...
Read more >
Troubleshoot Visual Studio installation and upgrade issues
Troubleshoot Visual Studio installation and upgrade issues · 1. Check whether the problem is a known issue · 2. Try repairing Visual Studio...
Read more >
CMake Error "could not find any instance of Visual Studio"
Is there a bug with Visual Studio installation? EDIT: We are using cmake 3.19 to reproduce this issue. I don't believe anything changed...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found