AcceptChanges blows up

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I keep a DataSet in a singleton class that I use to keep various global data
for a CF app. I bring down data with a webservice as a 2nd dataset, and
merge it into the global dataset (adding or updating records as needed). The
act of downloading them requires me to change a status-field in the affected
rows, so when it's all done I do an AcceptChanges so I'm ready for "real"
changes the user might input.

This works great when done on a primary thread for the initial fetch of
data. And it works great ONCE when invoked on a background thread that looks
for new data every few minutes. But after that first time, it goes bye-bye
on the AcceptChanges call. It does this in the debugger, but it also when
not in the debugger (I surround the call with a couple messageboxes and only
see the 1st one). I also have the whole block of code in a try/catch which
never triggers the catch.

Any thoughts on what could possibly make AcceptChanges on a 2nd thread
simply hang the app without throwing an exception? I've done this with
various records so I don't think it's the data content.
 
FWIW, I"ve determined that it only hangs the app on the 2nd AcceptChanges
when done on a separate thread. If I invoke all this code via a button on
the main UI thread it works fine. Does that shed any light on the problem?
 
That's expected if you have any UI controls bound to this data set.

Changing DataSet would fire ListChanged event which would cause UI update on
the non-owner thread.

That would lead to a very well documented hang. You should use
Control.Invoke to update DataSet bound to controls.


Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 
Back
Top