Nullreferenceexception when creating replication object

J

Janez

Hi,

I have developed CF application that works with SQL CE 2.0 and uses
merge replication for synchronization.
Synchronization generally works OK, only sometimes I receive
Nullreferenceexception when I try to create replication object with
this line of code
Repl = New System.Data.SqlServerCe.SqlCeReplication
This exception occurs only when I work with the application for some
time and never if I perform sync as the first action after application
startup. After the exception I am forced to close application to be
able to synchronize successfully. So, if I restart the application and
try to synchronize, the sync is completed OK.

About the application:
I use SQLCE data readers on one always opened SQL CE connection a lot
(I close connection only prior to sync and when exiting application).
I always close data readers after I am done with them and as I said I
do not have any problems with them in the application.

I have also found the following KB article
http://support.microsoft.com/default.aspx?scid=kb;en-us;827837

Can somebody tell me if this could be the problem? Did anybody
experience the same problem?

I am using SQL CE 2.0 with CF 2.0 SP2.

Regards
Janez
 
S

Sergey Bogdanov

First of all check out did you call .Dispose for your SqlCeReplication
object (it seems that you don't release all native resources). If it
doesn't help you please provide us with code snippet.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top