Bug #87306 StateChangeEventHandler not available as delegate
Submitted: 3 Aug 2017 15:27 Modified: 20 Apr 2018 6:16
Reporter: Andreas Goth Email Updates:
Status: Verified Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:Net 6.9.9 Ass V4.5 OS:Windows
Assigned to: CPU Architecture:Any
Tags: StateChange C# StateChangeEventHandler delegates

[3 Aug 2017 15:27] Andreas Goth
Description:
Visual Studio Express 2015 Windwos Desktop
MySQL Connector Net 6.9.9
MySQL Assemblies v4.5
C# WPF Window

On an
MySql.Data.MySqlClient.MySqlConnection
i try to generate an 
<object>.StateChange += new StateChangeEventHandler(<FunctionName>)
Event. 

BUT StateChangeEventHandler is not found in any Class of MySql or any else.
In Reference Guide if found only: 
https://dev.mysql.com/doc/connector-net/en/connector-net-ref-mysqlclient-mysqlconnectionme...

But there is no delegate Function for this in the reference manual. 

How to repeat:
 
using MySql;
using MySql.Data;
using MySql.Data.MySqlClient;

namespace SQL_Data_Handling
{
    
    public ConnectSQLServer()
   {
            InitializeComponent();
            MySql.Data.MySqlClient.MySqlConnection localConn = new MySql.Data.MySqlClient.MySqlConnection();
            localConn.StateChange += new StateChangeEventHandler(dummyfunction);       
            
   }

 private void dummyFunction(object sender, StateChangeEventArgs e)    
{
    //nothing to do because "StateChangeEventHandler" cannot found above
}

Suggested fix:
Perhaps there is a missing delegation for this in
MySql.Data.MySqlClient.MySqlConnection
[10 Aug 2017 12:13] Chiranjeevi Battula
Hello Andreas Goth,

Thank you for the bug report.
Could you please try this one:
localConn.StateChange += new System.Data.StateChangeEventHandler(dummyfunction);

Thanks,
Chiranjeevi.
[11 Aug 2017 6:45] Andreas Goth
Hello Chiranjeevi Battula,

i can compile it but the function "dummyfunction" will never executed. 
And now i cannnot execute any "MySqlCommand".

First i use the same function periodicly wihtin an "dispatcherTimer.Tick" Event and i can recognize any change of the state. Everything works fine...

When i using the same Function wihtin the "MySql.Data.MySqlClient.MySqlConnection" event, the same function will never executed and any command execution says that the connection is broken.

Something still not working :-)
[20 Apr 2018 6:16] Chiranjeevi Battula
Hello Andreas Goth,

Thank you for the bug report.
Verified based on internal discussion with dev's.

Thanks,
Chiranjeevi.