Bug #106309 Mysql Connector NET 8.0.28 RETURN INVALID ERROR CODE
Submitted: 27 Jan 2022 13:41 Modified: 27 Jan 2022 14:51
Reporter: mohamed atef Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:8.0.28 OS:Windows (64)
Assigned to: CPU Architecture:Any
Tags: Mysql Connector NET 8.0.28 RETURN INVALID ERROR CODE

[27 Jan 2022 13:41] mohamed atef
Description:
WHEN UPGRADE NET CONNECTOR TO 8.0.28
WHEN CONNECTING TO MYSQL SERVER AND SERVER IS STOPPED OR USING INVALID PORT RETURN INVALID INNER EXPECTION AND COMPILRE CAN`T GET IT AS MYSQLEXCEPTION

System.AggregateException: 'One or more errors occurred.'
SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:330

How to repeat:
CREATE SIMPLE WINFORM APPLICATION USING VISUAL STUDIO 2019
INSTALL MYSQL.DATA FROM NUGET PACKAGE AND SELECT VERSION 8.0.28
AND TRY THE FOLLOWING CODE 

 private int CheckConnection(string constr, out string ExMessage)
        {
            try
            {
                using (MySqlConnection Con = new MySqlConnection(constr))
                {
                    Con.Open();
                    if (Con.State == ConnectionState.Open)
                    {
                        Con.Close();
                    }
                }
                ExMessage = string.Empty;
                return 0;
            }
            catch (MySqlException EX)
            {
                ExMessage = EX.Message;
                return EX.Number;
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string MySqlConnStringss = MyConStr();
            int ExNumber = CheckConnection(MySqlConnStringss, out string ExMessage);

            MessageBox.Show(ExNumber.ToString() + " " + ExMessage);
        }
        private string MyConStr()
        {
            MySqlConnectionStringBuilder cons = new MySqlConnectionStringBuilder()
            {
                Server = "127.0.0.1",
                Port = 330,
                UserID = "root",
                Password = "yousef",
                Database = "abc",
                SslMode = MySqlSslMode.None,
                ConvertZeroDateTime = true,
                AllowUserVariables = true
            };
            return cons.ToString();
        }

ALTHOUGH I USING TRY TO CATCH MYSQLEXCEPTION THE EXCEPTION THROWN
IS 
System.AggregateException: 'One or more errors occurred.'
SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:330

THEN REPEAT THE PREVIOUS STEPS USING MYSQL.DATA V 8.0.27
RETURN MYSQLEXCEPTION WITH EXCEPTION NUMBER AND MESSAGE COULDNOT CONNECT TO ANY OF SPECIFIED MYSQL HOSTS.

Suggested fix:
MAY BE DUE TO NEW OPTIONS 
NET applications now can establish connections using multifactor authentication, such that up to three passwords can be specified at connect time. The new Password1, Password2, and Password3 connection options are available for specifying the first, second, and third multifactor authentication passwords, respectively. Password1 is a synonym for the existing Password option.
[27 Jan 2022 13:46] mohamed atef
PROJECT WITH CONNECTOR 27

Attachment: Connector27.zip (application/x-zip-compressed, text), 2.01 MiB.

[27 Jan 2022 13:46] mohamed atef
PROJECT WITH CONNECTOR 28

Attachment: Connector28.zip (application/x-zip-compressed, text), 2.05 MiB.

[27 Jan 2022 14:34] Bradley Grainger
This looks like a duplicate of bug #106242.
[27 Jan 2022 14:51] mohamed atef
duplicate of bug #106242
thanks Bradley Grainger