the remote connection to the device has been lost

N

Nathan Franklin

Hello list,

I have a problem with my application....
my program just closes, the debugger disconnects and the IDE comes up with
this message "The remote connection to the device has been lost"

The problem doesnt only happen with debugging, but if I deploy my app with a
debug config or even release config and run it by itself (without the IDE)
the program still closes... no exceptions are thrown the app just closes...
very frustrating

it closes on the line Application.DoEvents().

Before this line is called, im connecting to a database and run count(*) on
about 10 tables. my code then starts to create an xml document and also sets
a progressbar form control value to 0 and maximum to 0.

I have tried reconnecting my device, restarting the IDE and also rebooting
my computer...Still no luck....

My Project is hooked up to visual source safe... (i dont know if the means
anything)

My app was working fine and then all of a sudden, this started happeneing
and I just cant figure out why..

Could anyone assist me please....
thanks

Kind Regards
Nathan
 
L

Lonifasiko

I was suffering exactly same behaviour when doing synchronization the
server with Merge Replication.

I think my problem dissapeared when I deleted
replicationManager.Dispose(), which was not being used in the correct
way. I also was using a static variable for replicationManager, which I
deleted because I didn't need that to be static.

Be careful also when using Application.DoEvents(). I also used it in
the code that was breaking, and I still use it ;-)
I've seen in this group that it's not very good to manually force the
environment to process all messages in the queue.

I thougth this error was an environment error or an installation error,
but I finally modified somehow my code and noticed could be because of
a critical coding error.

That's all I can tell you. Hope it helps.
 
G

Guest

I have experienced this a few times in various circumstances.

One time it seemed to be directly related to the length of the call stack.
When I was constructing a new instance of an object inside a method call I
was getting the problem *every* time. Then when I moved the object
construction outside of the method call it worked ok *every* time...

SomeThing.DoSomething(new Something()); // This broke.

Something something = new Something();
Something.DoSomething(something); // This worked cool.

In this case DoSomething() actually did lots, it was a static method that
then performed work in another thread using BackgroundWorker etc etc etc so
it's definately hard to pinpoint. You might find like me that if you just
start changing things it'll go away.
 
N

Nathan Franklin

The line i actually found it to be erroring on was
ProgressBar1.Maximum = 0

It would work fine up until the next occurance of Application.DoEvents()

Note: ProgressBar.value = 0 before the ProgressBar.Maximum = 0 is called....

But I have just taken out the max call if it = 0, but the thing is I'm
pretty sure it used to work....
Can someone maybe shed some light as to what might be happening?

Thanks heaps

Nath
 

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