Posts

Showing posts from April, 2025

Can’t pair to Mac in Visual Studio 17+

  At the last time, I got an error “An error occurred while trying to configure the dotnet runtime. Pair To Mac agents cannot work without a valid runtime installed. Please try again Sequence contains no elements” from Visual Studio. At that time, I had Visual Studio 17.13.5. I tried several ways to fix issue, but not successful. After a while, I guess maybe dotnet sdk wasn’t installed on Mac yet. Finally, I ran this command on Mac to resolve the issue: brew install --cask dotnet-sdk After dotnet sdk was successfully installed on Mac, I tried to pair to Mac in Visual Studio again and everything worked fine. Hope this post would help you if you have the same issue! Happy coding 🙂

Don’t use Directory.GetCurrentDirectory() to get current directory in .NET

In some cases, using Directory.GetCurrentDirectory() can change the behavior of application because the current directory can be changed by calling Directory.SetCurrentDirectory. For complicated applications, changing the current directory can happen. The best would be using AppDomain.CurrentDomain.BaseDirectory to get the application base directory containing the folder of executable program. Hope this small post could help you! Happy coding 😊😊