Home All Groups Group Topic Archive Search About

Attempted to read or write protected memory. This is often an indication that other memory is corrup

Author
24 Feb 2006 10:13 AM
www.gusse.net
Have just switch from 1.1 to framework 2.0 and i´m getting this error :

Attempted to read or write protected memory. This is often an indication
that other memory is corrupt

anyone have a clu why ?

happens inside this :

public bool ExecSql(string sql)

{

bool ReturnValue = false;

OpenConnection();

OleDbCommand myCommand = new OleDbCommand(sql,oDatabaseConnection);


try

{

try

{

log.Debug("[ExecSql] SQL (ExecuteNonQuery): " + sql);


//OleDbTransaction myTrans =
oDatabaseConnection.BeginTransaction(IsolationLevel.ReadCommitted);

if (myTrans!=null)

myCommand.Transaction = myTrans;

myCommand.ExecuteNonQuery();

//myTrans.Commit();

ReturnValue = true;

}

catch (Exception ex)

{

log.Error("[ExecSql] Fatal error : " + ex.Message + " - " + sql);

}

}

finally

{

GC.Collect();

GC.WaitForPendingFinalizers();


}

return ReturnValue;

}

Author
24 Feb 2006 12:08 PM
Vadym Stetsyak
Hello, www.gusse.net!

wgn> Attempted to read or write protected memory. This is often an
wgn> indication that other memory is corrupt

What code part is throwing the exception?
myCommand.ExecuteNonQuery(); ?

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Author
24 Feb 2006 12:19 PM
www.gusse.net
yes ...


Show quote
"Vadym Stetsyak" <vady***@ukr.net> wrote in message
news:OeyFPsTOGHA.3732@TK2MSFTNGP10.phx.gbl...
> Hello, www.gusse.net!
>
> wgn> Attempted to read or write protected memory. This is often an
> wgn> indication that other memory is corrupt
>
> What code part is throwing the exception?
> myCommand.ExecuteNonQuery(); ?
>
> --
> Regards, Vadym Stetsyak
> www: http://vadmyst.blogspot.com
Author
24 Feb 2006 1:13 PM
Vadym Stetsyak
Have you tried executing same sql, directly on the server, I mean using such a tool as Query Analyzer or similar?
--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Author
24 Feb 2006 1:19 PM
www.gusse.net
yes it work,..

it all works in 1.1 framework and i have not changed one line of code..

very strange..

Show quote
"Vadym Stetsyak" <vady***@ukr.net> wrote in message
news:%23oETrQUOGHA.536@TK2MSFTNGP09.phx.gbl...
> Have you tried executing same sql, directly on the server, I mean using
> such a tool as Query Analyzer or similar?
> --
> Regards, Vadym Stetsyak
> www: http://vadmyst.blogspot.com
Author
24 Mar 2006 8:12 AM
brian.mills
I'm having a very similar problem talking to Oracle after .net 2.0 conversion
(Description below), it only hapens on one developer machine and our
development server though. Most developer machines are fine. Have you had any
luck solving your problem?

I'm trying to read data using a command object within .net 2.0. most of our
developer machines are working fine. However one developer machine, and the
dev server are coming up with the following exception when i try and connect
to oracle and do anything.



   at Oracle.DataAccess.Client.OpsSql.ExecuteReader(IntPtr opsConCtx,
IntPtr& opsErrCtx, IntPtr& opsSqlCtx, IntPtr opsSubscrCtx, Int32&
isSubscrRegistered, OpoSqlValCtx*& pOpoSqlValCtx, OpoSqlRefCtx&
pOpoSqlRefCtx, IntPtr[] pOpoPrmValCtx, OpoPrmRefCtx[] pOpoPrmRefCtx,
OpoMetValCtx*& pOpoMetValCtx, Int32 NoOfParams)
   at Oracle.DataAccess.Client.OracleCommand.ExecuteReader(Boolean requery,
Boolean fillRequest, CommandBehavior behavior)
   at Oracle.DataAccess.Client.OracleCommand.ExecuteReader()
   at Oracle.DataAccess.Client.OracleCommand.ExecuteScalar()
   at ConsoleAppTest.Class1.authenticateLogin(String username, String
password) in C:\Inetpub\wwwroot\ConsoleAppTest\Class1.cs:line 210

Oracle.DataAccess

Attempted to read or write protected memory. This is often an indication
that other memory is corrupt.

System.AccessViolationException

Int32 ExecuteReader(IntPtr, IntPtr ByRef, IntPtr ByRef, IntPtr, Int32 ByRef,
Oracle.DataAccess.Client.OpoSqlValCtx* ByRef,
Oracle.DataAccess.Client.OpoSqlRefCtx ByRef, IntPtr[],
Oracle.DataAccess.Client.OpoPrmRefCtx[],
Oracle.DataAccess.Client.OpoMetValCtx* ByRef, Int32)

System.AccessViolationException: Attempted to read or write protected
memory. This is often an indication that other memory is corrupt.
   at Oracle.DataAccess.Client.OpsSql.ExecuteReader(IntPtr opsConCtx,
IntPtr& opsErrCtx, IntPtr& opsSqlCtx, IntPtr opsSubscrCtx, Int32&
isSubscrRegistered, OpoSqlValCtx*& pOpoSqlValCtx, OpoSqlRefCtx&
pOpoSqlRefCtx, IntPtr[] pOpoPrmValCtx, OpoPrmRefCtx[] pOpoPrmRefCtx,
OpoMetValCtx*& pOpoMetValCtx, Int32 NoOfParams)
   at Oracle.DataAccess.Client.OracleCommand.ExecuteReader(Boolean requery,
Boolean fillRequest, CommandBehavior behavior)
   at Oracle.DataAccess.Client.OracleCommand.ExecuteReader()
   at Oracle.DataAccess.Client.OracleCommand.ExecuteScalar()
   at ConsoleAppTest.Class1.authenticateLogin(String username, String
password) in C:\Inetpub\wwwroot\ConsoleAppTest\Class1.cs:line 210

I've read alot of people with the problem, but no solutions seem to be out
there.

Has anyone had this problem? and if so why? I cant find anyway arround it.
The code we are running is dirt simple. "select userID from
HCD02.tblUserLoginCredentials where username = :username and password =
:password" and it works on .net 1.1 but not on .net 2.0? however it does work
on .net 2.0 on most of our developer machines.
Author
13 Apr 2006 4:45 PM
Taylor Brown
http://www.ben-rush.net/blog/PermaLink,guid,bda5e880-36c6-4a2f-963e-02162242a773.aspx

This guy's blog claims that not calling Read before calling GetValue
will cause this issue. I am not an expert on this, but I saw you had
the same problem and were usign Oracle, so I thought I'd mention it.
We get it when using remoting.  Frustrating stuff...

AddThis Social Bookmark Button