Re: AccessViolationException and Native Exception



On 31 Mag, 16:02, paolo.patie...@xxxxxxxxx wrote:
On 31 Mag, 15:46, "Ginny Caughey [MVP]"





<ginny.caughey.onl...@xxxxxxxxxxxxxx> wrote:
Thanks. I look forward to the sample. Is it possible you're trying to
dispose a data reader you've already closed or something like that?

--
Ginny

<paolo.patie...@xxxxxxxxx> wrote in message

news:1180618218.459229.38130@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello Ginny,
while I prepare the sample you asked me, I send you the exception
detail thrown :

System.AccessViolationException non è stata gestita
Message="Tentativo di lettura o scrittura della memoria protetta.
Spesso questa condizione indica che altre parti della memoria sono
danneggiate."
Source="System.Data.SqlServerCe"
StackTrace:
in System.Data.SqlServerCe.NativeMethods.SafeRelease(IntPtr&
ppUnknown)
in System.Data.SqlServerCe.SqlCeDataReader.Dispose(Boolean
disposing)
in System.Data.SqlServerCe.SqlCeDataReader.Finalize()

I hope this help...

Ginny Caughey [MVP] ha scritto:

I'm not aware of any problems with drivers, and especially since you're
using the .NET wrappers. Do you have a small reproducible sample?

--
Ginny

<paolo.patie...@xxxxxxxxx> wrote in message
news:1180596359.936238.294550@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On 30 Mag, 18:59, "Ginny Caughey [MVP]"
<ginny.caughey.onl...@xxxxxxxxxxxxxx> wrote:
Are you using a single connection throughout your app, or different
connections for each thread?

--
Ginny

<paolo.patie...@xxxxxxxxx> wrote in message

news:1180535055.100686.32530@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Hello,

I'm developing a multithreading application in C# with Compact
Framework 2.0 and Sql Server 2005 Compact Edition. Sometimes and
randomly, the following exception is thrown :

AccessViolationException in System.Data.SqlServerCe.NativeMethod()...

Why ?

Thank you, very much.- Nascondi testo tra virgolette -

- Mostra testo tra virgolette -

Actually, the methods to access the database are in a single thread
and each method opens the connection, does the operations and finally
closes the connection. I don't think it's a problem of multithreading,
because others threads don't use the database. Is there any problem in
the SQL Server Compact Edition drivers ?- Nascondi testo tra virgolette -

- Mostra testo tra virgolette -

But the error is randomly. Sometimes, the same code work properly and
other times it's go wrong and the exception is thrown. I'm writing the
sample and I post it shortly (in 10 minutes). Thank you very much for
your help.- Nascondi testo tra virgolette -

- Mostra testo tra virgolette -

Good morning, Ginny...

yesterday I have solved the problem with yuor suggestion. There were
some DataReader unclosed !!!
Thank yuo very much for your help.

.



Relevant Pages

  • Re: AccessViolationException and Native Exception
    ... dispose a data reader you've already closed or something like that? ... while I prepare the sample you asked me, I send you the exception ... the following exception is thrown: ... and each method opens the connection, ...
    (microsoft.public.sqlserver.ce)
  • Re: what am I doing wrong ?
    ... exception being thrown. ... close the connection in the finally, because we can't rely on the dispose ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: VS2005 and SQL Express: Internal .Net Framework Data Provider
    ... connection object you use. ... public void CreateConnection{ ... // Close first and dispose the existing data reader is there ... release resources used by the object ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: C# and GDI Resources
    ... interface use unmanaged resources; i.e. they end up being a wrapper to ... The rule is, if the object has a Dispose or Close method, make SURE you ... your class opens a database connection when an object is instanciated ... method would make sure to Dispose the database connection. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: SqlConnection.Dispose close connection?
    ... The fact is that the garbage collector in c# is a generational collector. ... But a connection could be kept for longer use of course; ... Dispose calls Close anyway. ... By doing so you ensure that the unmanaged resource (i.e., ...
    (microsoft.public.dotnet.languages.csharp)

Loading