.NET 6 not showing up in Visual Studio 2022

I have .NET 6 installed. But it doesn’t show up. I even have the "Use previews of the .NET SDK" on. I don’t understand what I’m missing. >Solution : First of all .NET Framework 6.0 does not exist, the latest release is actually .NET Framework 4.8.1. What you mean is .NET 6 or if you… Read More .NET 6 not showing up in Visual Studio 2022

C# Wait for function but with a timeout. How do I make my function async?

I have the same requirement as the poster in Async wait. I want to wait for a function to return but also set a timeout value. I want to use the part : int timeout = 1000; var task = SomeOperationAsync(); if (await Task.WhenAny(task, Task.Delay(timeout)) == task) { // task completed within timeout } else… Read More C# Wait for function but with a timeout. How do I make my function async?

Adding Service from dynamically loaded Assembly to ServiceCollection?

maybe someone can help me out with this one: I’m writing a Program, that dynamically loads assemblies that have different implementations of the same interface "IMyService". The case may occur, that some of the assemblies aren’t even there (imagine this as a set of different modules of a software a user can buy… Some are… Read More Adding Service from dynamically loaded Assembly to ServiceCollection?

From a GRPC Project, call a method on another GRPC project, in a different solution

I’m using GRPC in C#, I already have a GRPC Project that uses its locals methods / proto classes, but don’t know how to call a method that’s in a different GRPC service that I referenced my adding the corresponding Nuget Package. Do I need to create that service proto method again? I’m not sure… Read More From a GRPC Project, call a method on another GRPC project, in a different solution

How can I map a xmlns and a clr-namespace in .NET 6.0 like XmlnsDefinitionAttribute?

I used System.Windows.Markup.XmlnsDefinitionAttribute in .NET Framework 4.7.2 before and I cannot find the corresponding type in .NET 6.0. MSDN – XmlnsDefinitionAttribute says that it is not supported in .NET 6.0. How can I map a XAML namespace to a clr-namespace in .NET 6.0? >Solution : WPF was part of the monolithic .NET Framework. Since .NET… Read More How can I map a xmlns and a clr-namespace in .NET 6.0 like XmlnsDefinitionAttribute?

Dependency Property change callback called but value not displayed

I am building a WPF application in .NET 6. I have a MainWindow with a property. public Profile SelectedProfile { get => _selectedProfile; set { _selectedProfile = value; OnPropertyChanged(); } } This property is used in controls of MainWindow- updated by ComboBox and displayed in TextBoxes. That works as desired. I have also made a… Read More Dependency Property change callback called but value not displayed

Inject DbContext without explicitly passing as constructor argument in .net6.0 console app

I’m trying to do a c# console app (.net6.0). Here is my program.cs IHost host = Host.CreateDefaultBuilder(args) .ConfigureServices((context, services) => { var cns = context.Configuration.GetConnectionString("db"); services.AddDbContext<DatabaseContext>(options => options.UseMySql(cns,ServerVersion.AutoDetect(cns) )); }) .Build(); //Want to create new instance of Ghonta, without passing DatabaseContext parameter. Ghonta g = new Ghonta(); Ghonta.cs- public class Ghonta{ private readonly DatabaseContext db;… Read More Inject DbContext without explicitly passing as constructor argument in .net6.0 console app

Why using tabs with Console.WriteLine don't show background color?

When you print tabs using Console.WriteLine, they never use the specified background color: Console.BackgroundColor = ConsoleColor.Red; Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("No tabs, no spaces"); Console.WriteLine("\tTabs don’t have background color"); Console.WriteLine(" Spaces have background color"); Did I miss something or is it by design? >Solution : After some testing it looks like this is related to how… Read More Why using tabs with Console.WriteLine don't show background color?