Search code examples
c#sybaseaccess-violationsap-ase

AseConnection.Open() throws AccessViolationException


A line of code that's been working for as long as I can remember has suddenly stopped working and it's now throwing an AccessViolationException:

Exception:

System.AccessViolationException was unhandled
Message=Attempted to read or write protected memory. This is often an indication that
other memory is corrupt.
Source=Sybase.Data.AseClient
StackTrace:
    at Sybase.Data.AseClient.AseConnectionPool.ᜀ(AseConnection A_0)
    at Sybase.Data.AseClient.AseConnectionPoolManager.ᜀ(String A_0, AseConnection A_1)
    at Sybase.Data.AseClient.AseConnection.Open()
InnerException:

Code:

using (var connection = new AseConnection(this.ConnectionString))
{
    using (var command = connection.CreateCommand())
    {
        command.CommandText = "select * from TABLE_NAME";
        command.Connection.Open();
        ...

I've rebooted my machine, checked for recent Windows Updates, ran CHKDSK, uninstalled and re-installed Sybase but nothing seems to work!

I'm targeting a Sybase 12.5.4 database using a 64bit Sybase 12.5.4 client with Sybase.Data.AseClient.dll referenced in my code (same version as Production code - which is working without issue) and sybdrvado11.dll is available when the application's running. Literally nothing has changed since it was last working.

Using Toad, I'm still able to connect and interact with the database as well, so it looks like this issue is only affecting my code.

Has anyone experienced this issue before?


Solution

  • Turned out to be a database permissions issue relating to group membership... I was removed the problem group and everything came to life again.