Connecting to SQL without freezing WPF :     private async void Button_Click(object sender, RoutedEventArgs e)
            {
                var sampleMessageDialog = new SampleMessageDialog
                {
                    Message = { Text = "Failed to connect" }
                };
    
                
                SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionS"].ConnectionString);
                try
                {
                    con.Open();
                  //  await DialogHost.Show(sampleMessageDialog, "RootDialog");
                    con.Close();
                }
                catch (Exception ex)
                {
                    await DialogHost.Show(sampleMessageDialog, "RootDialog");
                }
    
        
            }

Everything seem to run smoothly when the credentals are correct. However, when I put the wrong credentials for the SQL connection string, It seem to freez, the sec I click the button and the dialog only show after freez.