c# - FatalExecutionEngineError with MySQLConnector/Net -


i'm developing c#.net application connects mysql db , uses unsafe code able use old c++ dll.

as program starts, load dll , allocate pointer, initialize c# variables, delete pointer.

in program have dialog has tab control within. constructor of "dialog" fetches data variables initialized old dll , db , here start problems:

        dictionary<string, int> dizum;         mysqlcommand            mycom;         mysqlconnection         myconn;         mysqldatareader         myread;          cmbrighecons.items.add( mosaicos.properties.resources.str_cons_desc_gen );         cmbrighecons.items.add( mosaicos.properties.resources.str_cons_tip_sott );         cmbrighecons.items.add( mosaicos.properties.resources.str_cons_sott );         cmbrighecons.items.add( mosaicos.properties.resources.str_cons_nom_pez_cons );         cmbrighecons.selectedindex = mosaicomain.cfg.desccons;         cmbrighevarmat.items.add( mosaicos.properties.resources.str_cons_desc_gen );         cmbrighevarmat.items.add( mosaicos.properties.resources.str_cons_tip_sott );         cmbrighevarmat.items.add( mosaicos.properties.resources.str_cons_sott );         cmbrighevarmat.items.add( mosaicos.properties.resources.str_cons_nom_pez_cons );         cmbrighevarmat.items.add( mosaicos.properties.resources.str_cons_nom_pez_nel_cons );         cmbrighevarmat.selectedindex = mosaicomain.cfg.descvarmat;         try         {             string connessione;              connessione = mosaicomain.cfg.dbconnection.replace( "option=3;", "" );             connessione = connessione.replace( "driver={mysql odbc 5.1 driver};", "" );             myconn = new mysqlconnection( connessione );             mycom = new mysqlcommand();             myconn.open();             mycom.connection = myconn;             mycom.commandtext = @"select umi_id, umi_um unimis umi_tipoum = 0 order umi_um;";             myread = mycom.executereader();             dizum = new dictionary<string, int>();             while( myread.read() )                 dizum.add( myread.getstring( 1 ), myread.getint32( 0 ) );             cmbumsup.datasource = new bindingsource( dizum, null );             cmbumsup.displaymember = "key";             cmbumsup.valuemember = "value";             myread.close();             myconn.close();         }         catch( mysqlexception mysqlexception )         {             messagebox.show( mysqlexception.tostring() );         }  

here if comment myconn.open(); myconn.close(); i've got no troubles, opening connection results in immediate program crash when switch between tables, not in part of program in:

    private void configurazionitoolstripmenuitem1_click( object sender, eventargs e )     {         try         {             frmconfig = new frmconfigurazioni();             frmconfig.showdialog();         }         catch( exception exception )         {             messagebox.show( exception.tostring() );         }     } 

which load previous code snippet. error is:

managed debugging assistant 'fatalexecutionengineerror' has detected problem in  'c:\develop\mosaicos\mosaicos\bin\debug\mosaicos.vshost.exe'. additional information: runtime has encountered fatal error.  address of error @ 0x792380d9, on thread 0x824.  error code 0xc0000005.  error may bug in clr or in unsafe or non-verifiable portions of user code.  common sources of bug include user marshaling errors com-interop or pinvoke, may corrupt stack. 

and not exception. if comment code, don't crash, also, if try connect same string same database in solution, i've got no problems. how can solve this?

thanks in advance.

'0xc0000005' access violation exception. difficult find out wrong code have provided. suggest find source code of old c++ dll , debug them in 1 solution. can debug c++ dll .net checking "enable unmanaged code debugging" check box under debug section in .net project properties.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -