DevartODBCSQLite.dll - AccessViolationException in .Net software

Discussion of open issues, suggestions and bugs regarding usage of ODBC Drivers
Post Reply
y.guillermin
Posts: 1
Joined: Thu 02 Mar 2017 15:08

DevartODBCSQLite.dll - AccessViolationException in .Net software

Post by y.guillermin » Thu 02 Mar 2017 15:54

Hello,

My company just bougth the Devart SQLite ODBC driver for making some tests with the software we develop in C# .Net WinForm (4.0), in order to replace current ASA 9 database by a sqlite database.
All database calls are made using ODBC.

During my tests, our software crash regularly on SQLite Database query (OdbcCommand.ExecuteScalar(), OdbcCommand.ExecuteReader(), OdbcDataAdpater.Fill()...)

I have tried to use direct mode or not, result is always the same, our application crash, getting a AccesViolationException like you can see below (windows system logs).

What can I do to solve this problem ? Should I modify the configuration of Devart SQLite ODBC Driver ? Need I make some change in my code ? (Example of code below)

Thanks in advance.
Cordialy,

Yvan Guillermin

Windows system logs :
Nom de l’application défaillante SIECL.exe, version : 5.8.0.6, horodatage : 0x58b832d0
Nom du module défaillant : DevartODBCSQLite.dll, version : 2.1.4.0, horodatage : 0x583d74c5
Code d’exception : 0xc0000005
Décalage d’erreur : 0x00215644
ID du processus défaillant : 0x2944
Heure de début de l’application défaillante : 0x01d2936594b918f3
Chemin d’accès de l’application défaillante : E:\Projets\SIECL application\SieclV5\Dev\20170227_SGBD_Tests_SQLite\Windows\bin\Debug\SIECL.exe
Chemin d’accès du module défaillant: C:\Program Files (x86)\Devart\ODBC\SQLite\win32\DevartODBCSQLite.dll
ID de rapport : 53702301-6384-4c92-9e78-97f1129ac76b
Nom complet du package défaillant :
ID de l’application relative au package défaillant :
Application : SIECL.exe
Version du Framework : v4.0.30319
Description : le processus a été arrêté en raison d'une exception non gérée.
Informations sur l'exception : System.AccessViolationException
Pile :
à System.Data.Common.UnsafeNativeMethods.SQLAllocHandle(SQL_HANDLE, System.Data.Odbc.OdbcHandle, IntPtr ByRef)
à System.Data.Odbc.OdbcHandle..ctor(SQL_HANDLE, System.Data.Odbc.OdbcHandle)
à System.Data.Odbc.OdbcConnection.CreateStatementHandle()
à System.Data.Odbc.OdbcCommand.GetStatementHandle()
à System.Data.Odbc.OdbcCommand.ExecuteReaderObject(System.Data.CommandBehavior, System.String, Boolean, System.Object[], SQL_API)
à System.Data.Odbc.OdbcCommand.ExecuteReaderObject(System.Data.CommandBehavior, System.String, Boolean)
à System.Data.Odbc.OdbcCommand.ExecuteScalar()
à SocleTechnique.DataServices.DataManager.ExecuteScalar(System.String, System.Object[])
à Commun.ControleAcces.CCtrl_ControleAcces.PossederDomaineAministration(System.String)
à Commun.ControleAcces.CCtrl_ControleAcces.ActiverMenus(System.Windows.Forms.MenuStrip, System.String, System.String, System.String, System.String)
à Commun.AppliAmont.Exploit.initInfosExploitation()
à Commun.AppliAmont.Exploit.fg_Exploit_RowColChange(System.Object, System.EventArgs)
à C1.Win.C1FlexGrid.C1FlexGridBase.OnRowColChange(System.EventArgs)
à C1.Win.C1FlexGrid.C1FlexGridBase.OnAfterSelChange()
à C1.Win.C1FlexGrid.C1FlexGridBase.OnGridChanged(System.Object, C1.Win.C1FlexGrid.GridChangedEventArgs)
à C1.Win.C1FlexGrid.C1FlexGrid.OnGridChanged(System.Object, C1.Win.C1FlexGrid.GridChangedEventArgs)
à SocleTechnique.GUIComponents.ExFlexGrid.OnGridChanged(System.Object, C1.Win.C1FlexGrid.GridChangedEventArgs)
à Š.ˆŠ.(C1.Win.C1FlexGrid.GridChangedTypeEnum, Int32, Int32, Int32, Int32)
à Š.ˆŠ.(C1.Win.C1FlexGrid.GridChangedTypeEnum)
à Š.™Š.Select(C1.Win.C1FlexGrid.C1FlexGridBase, C1.Win.C1FlexGrid.CellRange, Boolean, Boolean)
à C1.Win.C1FlexGrid.C1FlexGridBase.Select(C1.Win.C1FlexGrid.CellRange, Boolean)
à Š.“Š.€’(System.Windows.Forms.MouseEventArgs)
à Š.“Š.’(System.Windows.Forms.MouseEventArgs)
à C1.Win.C1FlexGrid.C1FlexGridBase.OnMouseDown(System.Windows.Forms.MouseEventArgs)
à System.Windows.Forms.Control.WmMouseDown(System.Windows.Forms.Message ByRef, System.Windows.Forms.MouseButtons, Int32)
à System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef)
à C1.Win.C1FlexGrid.Util.BaseControls.ScrollableControl.WndProc(System.Windows.Forms.Message ByRef)
à System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef)
à System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef)
à System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)
à System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef)
à System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr, Int32, Int32)
à System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)
à System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)
à System.Windows.Forms.Application.Run(System.Windows.Forms.Form)
à Commun.AppliAmont.MenuPrincipal.Main()
Source code where the crash is observed :
Here the crash is observed on cmd.ExecuteScalar();

Code: Select all

public static object ExecuteScalar(string requete, params object[] parametresRequete)
        {
            object obj_ret;
            EtablirConnexion();
            try
            {
                Monitor.Enter(conn);
                OdbcCommand cmd = new OdbcCommand(requete, conn, transaction);
                requete = requete.Replace(";", "");

                if (parametresRequete.Length != 0)
                {
                    foreach (object obj in parametresRequete)
                    {
                        OdbcParameter newParam = new OdbcParameter();
                        if (obj == null)
                            newParam.Value = DBNull.Value;
                        else
                            newParam.Value = obj;

                        cmd.Parameters.Add(newParam);

                    }
                }
                obj_ret = cmd.ExecuteScalar();
            }
            finally
            {
                Monitor.Exit(conn);
            }
            return obj_ret;
        }

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: DevartODBCSQLite.dll - AccessViolationException in .Net software

Post by MaximG » Mon 06 Mar 2017 13:48

Please specify whether the described error occurs when executing any query or a particular one. For further problem investigation, using the e-support form ( https://www.devart.com menu "Support\"support request ), send us a query sample which execution when using the ExecuteScalar method causes an error. In addition, we will need DDL-script to create tables used in this query. Besides, if you do not mind, please send us the log file created by the "ODBC Data Source Administrator" utility ("Tracing" tab).

Post Reply