datagrid scrolling/ threading problem

  • Thread starter Thread starter hs
  • Start date Start date
H

hs

Hi Everyone,
I'm having a few problems with events, threads, datagrid scroll and
refreshing (winform).
I have a datagrid whose datasource is a dataset. This dataset contains a
subset of the records requested. When a datagrid.scroll event is triggered -
1) I check the current subset (chunk) of data being displayed.
2) If there more chunks of data to come, create a thread, get next chunk of
data and place in a new dataset.
3) In main thread, merge this dataset with original dataset.

Now this works fine if I scroll by pressing the down arrow or just above the
arrow (which makes it scroll quicker). However, if I drag the scroll bar
down to the bottom (ie the quickest way to get to the bottom of the
datagrid) it freezes. It starts the thread (which is what i expect) to
retrieve the next chunk of data, but freezes.
I have an Application.DoEvents() in my code but doesn't solve the problem. I
think there's an event problem here but am not sure.
Any ideas?
thanks

private void dataGrid1_Scroll(object sender, EventArgs e)
{
DataGrid.HitTestInfo dgHti = dataGrid1.HitTest(42,42);
int iCurrentRow=dgHti.Row;

// Check (if Row near end of Last Chunk) if Fetch complete
if((iCurrentRow > (this.chunkLast * 750) + 225) && this.chunkNew > 0)
{
while(this.chunkFetch)
{
Thread.Sleep(250);
}
}

// Check if Fetch complete
if(!this.chunkFetch && this.chunkNew > 0)
{
this.ds.Merge(this.dsNew);
this.chunkLast ++;
this.chunkNew --;
this.dsNew.Tables.Clear();
}

// Chech if New Chunk Needed
if((iCurrentRow >= ((this.chunkLast ) * 750) )&& this.chunkNew == 0 &&
this.chunkLast < 4)
{
this.chunkNew ++;
this.chunkFetch = true;
this.dsNew = new DataSet();

Application.DoEvents();
dataGrid1.Refresh();

// Create Threads
Thread newThread = new Thread(new ThreadStart(this.FetchNextChunk));

// Start the thread
newThread.Start();
}
}
 
Hi,
My understanding now your problem is related to the call frequency of
the OnScroll event handler.
If the frequency is low, then it works fine, when the frequency go up, you
code breaks down.
I'd like you do some further tests, and add some debug out put in your
codes(such as before/after the while loop, and etc).
Have you tried to test your code by scrolling the datagrid
programmaticlly, such as setting current to the end, or scrolling the
datagrid at an interval.
After reading your code, I have some concern on the While loop and the
call Application.DoEvent(), because the DoEvent may cause the reentrance
of the OnScroll event handler, and if it reenters, it freezes;
And I also noticed you have an if statement before doing the waiting
loop( while(this.chunkFetch)). I'm not clear if there are any chances that
the if statement will not meet when a thread is running.
You didn't provide the code of method FetchNextChunk, I'm not sure if
there is some racing condition problems between threads.
Thanks!

Kind regards,

Ying-Shen Yu [MS]
Microsoft Support Engineer

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. 2001 Microsoft Corporation. All rights
reserved.
--------------------
| Reply-To: "hs" <[email protected]>
| From: "hs" <[email protected]>
| Subject: datagrid scrolling/ threading problem
| Date: Thu, 4 Sep 2003 16:24:59 +0100
| Lines: 63
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| NNTP-Posting-Host: mailgate.synergy-logistics.co.uk 62.49.130.162
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:51637
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
|
| Hi Everyone,
| I'm having a few problems with events, threads, datagrid scroll and
| refreshing (winform).
| I have a datagrid whose datasource is a dataset. This dataset contains a
| subset of the records requested. When a datagrid.scroll event is
triggered -
| 1) I check the current subset (chunk) of data being displayed.
| 2) If there more chunks of data to come, create a thread, get next chunk
of
| data and place in a new dataset.
| 3) In main thread, merge this dataset with original dataset.
|
| Now this works fine if I scroll by pressing the down arrow or just above
the
| arrow (which makes it scroll quicker). However, if I drag the scroll bar
| down to the bottom (ie the quickest way to get to the bottom of the
| datagrid) it freezes. It starts the thread (which is what i expect) to
| retrieve the next chunk of data, but freezes.
| I have an Application.DoEvents() in my code but doesn't solve the
problem. I
| think there's an event problem here but am not sure.
| Any ideas?
| thanks
|
| private void dataGrid1_Scroll(object sender, EventArgs e)
| {
| DataGrid.HitTestInfo dgHti = dataGrid1.HitTest(42,42);
| int iCurrentRow=dgHti.Row;
|
| // Check (if Row near end of Last Chunk) if Fetch complete
| if((iCurrentRow > (this.chunkLast * 750) + 225) && this.chunkNew > 0)
| {
| while(this.chunkFetch)
| {
| Thread.Sleep(250);
| }
| }
|
| // Check if Fetch complete
| if(!this.chunkFetch && this.chunkNew > 0)
| {
| this.ds.Merge(this.dsNew);
| this.chunkLast ++;
| this.chunkNew --;
| this.dsNew.Tables.Clear();
| }
|
| // Chech if New Chunk Needed
| if((iCurrentRow >= ((this.chunkLast ) * 750) )&& this.chunkNew == 0 &&
| this.chunkLast < 4)
| {
| this.chunkNew ++;
| this.chunkFetch = true;
| this.dsNew = new DataSet();
|
| Application.DoEvents();
| dataGrid1.Refresh();
|
| // Create Threads
| Thread newThread = new Thread(new ThreadStart(this.FetchNextChunk));
|
| // Start the thread
| newThread.Start();
| }
| }
|
|
|
 
Hi Ying-Shen,
Here is some more information. I have added a method WriteEventLog (writes
to a log file, written in green below) to give me a trace of what is
happenning.
After reading your code, I have some concern on the While loop and the
call Application.DoEvent(), because the DoEvent may cause the reentrance
of the OnScroll event handler, and if it reenters, it freezes;
I have also removed the Application.DoEvents

private void dataGrid1_Scroll(object sender, EventArgs e)
{
DataGrid.HitTestInfo dgHti = dataGrid1.HitTest(42,42);
int iCurrentRow=dgHti.Row;

// Check (if Row near end of Last Chunk) if Fetch complete
if((iCurrentRow > (this.chunkLast * 750) + 225) && this.chunkNew > 0)
{
//MessageBox.Show("1st if test");
WriteEventLog("**1st if test");
while(this.chunkFetch)
{
WriteEventLog("**main thread sleep");
Thread.Sleep(250);
}
}

// Check if Fetch complete
if(!this.chunkFetch && this.chunkNew > 0)
{
WriteEventLog("**2nd if test");
this.ds.Merge(this.dsNew);
this.chunkLast ++;
this.chunkNew --;
this.dsNew.Tables.Clear();
}

// Chech if New Chunk Needed
if((iCurrentRow >= ((this.chunkLast ) * 750) )&& this.chunkNew == 0 &&
this.chunkLast < 4)
{
WriteEventLog("**3rd if test");
this.chunkNew ++;
this.chunkFetch = true;
this.dsNew = new DataSet();

//Application.DoEvents();
//dataGrid1.Refresh();

// Create Threads
Thread newThread = new Thread(new ThreadStart(this.FetchNextChunk));

// Start the thread
newThread.Start();
}
}
when i scroll, it freezes (stuck in the while loop). The event log shows the
folllowing sequence : -
**3rd if test
**1st if test
**main thread sleep
**client: fetchnextchunk method start
**main thread sleep
**main thread sleep
**main thread sleep
**main thread sleep
**main thread sleep
**main thread sleep
**main thread sleep
**main thread sleep

Now if I uncomment the messagebox, I dont get any freezing and gives a more
desirable result. Trace as follows:-
**3rd if test
**client: fetchnextchunk method start
**server-main method: start fetch
**client: ws-fetch method completed
**client: fetchnextchunk method end
**1st if test
**2nd if test
My understanding now your problem is related to the call frequency of
the OnScroll event handler.
If the frequency is low, then it works fine, when the frequency go up, you
code breaks down.

From what you have said, this means the message box is breaking up the
frequency of calls to the scroll event handler. How can I achieve this
without using a messagebox.
You didn't provide the code of method FetchNextChunk, I'm not sure if
there is some racing condition problems between threads.

FetchNextChunk is a method which calls a webservice which returns the next
chunk of data (using Dime) and puts it into a dataset (this.dsNew). It then
sets this.chunkFetch = false.
And I also noticed you have an if statement before doing the waiting
loop( while(this.chunkFetch)). I'm not clear if there are any chances that
the if statement will not meet when a thread is running.

for this test i think its okay.

I would appreciate any further feedback.
thanks
 
Hi hs,
Thanks for the debug output, I think the problem is more clearer, it
sounds like a thread synchronization problem, however, to find the exact
reason I think we need do some more inspection on it.

1. From your reply I am not clear about How you got this debug output. Is
it made by dragging the scrollbar down as fast as possible? It's not easy
to say how fast you are,right?, that's why I recommended you using
scrolling programmaticly. And I think maybe a debug ouput by pressing the
arrows keys slowly will also do some help, do you think so?

2. From the Debug ouput, I find that your code route is first enter the 3rd
if statement block then enter the 1st if block (the DoEvent() is really
dangerous). the worker thread has been started, but I have some concern on
the reason why it doesn't stop, Is it waiting for something or it's just
you didn't write an event log on it's exiting?
Maybe you should add some event log in the thread procedure, e.g. around
the setting/getting of the chunkFetch(you may print out the chunkFetch's
value in to the Eventlog file), before and after some key procedure (which
will cost some time, or blockable). and at the end of the thread procedure.

3.A small advice on your event log class is add a timestamp in your log
output,that would be helpfule to get some idea on the call frequency.

I'll wait for your further information ,and do research with you, thanks!

Kind regards,

Ying-Shen Yu [MS]
Microsoft Support Engineer

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. 2001 Microsoft Corporation. All rights
reserved.
--------------------
| Reply-To: "hs" <[email protected]>
| From: "hs" <[email protected]>
| References: <[email protected]>
<J#[email protected]>
| Subject: Re: datagrid scrolling/ threading problem
| Date: Fri, 5 Sep 2003 15:52:55 +0100
| Lines: 108
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| NNTP-Posting-Host: mailgate.synergy-logistics.co.uk 62.49.130.162
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:51742
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
|
| Hi Ying-Shen,
| Here is some more information. I have added a method WriteEventLog (writes
| to a log file, written in green below) to give me a trace of what is
| happenning.
|
| > After reading your code, I have some concern on the While loop and
the
| > call Application.DoEvent(), because the DoEvent may cause the
reentrance
| > of the OnScroll event handler, and if it reenters, it freezes;
| I have also removed the Application.DoEvents
|
| private void dataGrid1_Scroll(object sender, EventArgs e)
| {
| DataGrid.HitTestInfo dgHti = dataGrid1.HitTest(42,42);
| int iCurrentRow=dgHti.Row;
|
| // Check (if Row near end of Last Chunk) if Fetch complete
| if((iCurrentRow > (this.chunkLast * 750) + 225) && this.chunkNew > 0)
| {
| //MessageBox.Show("1st if test");
| WriteEventLog("**1st if test");
| while(this.chunkFetch)
| {
| WriteEventLog("**main thread sleep");
| Thread.Sleep(250);
| }
| }
|
| // Check if Fetch complete
| if(!this.chunkFetch && this.chunkNew > 0)
| {
| WriteEventLog("**2nd if test");
| this.ds.Merge(this.dsNew);
| this.chunkLast ++;
| this.chunkNew --;
| this.dsNew.Tables.Clear();
| }
|
| // Chech if New Chunk Needed
| if((iCurrentRow >= ((this.chunkLast ) * 750) )&& this.chunkNew == 0 &&
| this.chunkLast < 4)
| {
| WriteEventLog("**3rd if test");
| this.chunkNew ++;
| this.chunkFetch = true;
| this.dsNew = new DataSet();
|
| //Application.DoEvents();
| //dataGrid1.Refresh();
|
| // Create Threads
| Thread newThread = new Thread(new
ThreadStart(this.FetchNextChunk));
|
| // Start the thread
| newThread.Start();
| }
| }
| when i scroll, it freezes (stuck in the while loop). The event log shows
the
| folllowing sequence : -
| **3rd if test
| **1st if test
| **main thread sleep
| **client: fetchnextchunk method start
| **main thread sleep
| **main thread sleep
| **main thread sleep
| **main thread sleep
| **main thread sleep
| **main thread sleep
| **main thread sleep
| **main thread sleep
|
| Now if I uncomment the messagebox, I dont get any freezing and gives a
more
| desirable result. Trace as follows:-
| **3rd if test
| **client: fetchnextchunk method start
| **server-main method: start fetch
| **client: ws-fetch method completed
| **client: fetchnextchunk method end
| **1st if test
| **2nd if test
|
| > My understanding now your problem is related to the call frequency
of
| > the OnScroll event handler.
| > If the frequency is low, then it works fine, when the frequency go up,
| you
| > code breaks down.
|
| From what you have said, this means the message box is breaking up the
| frequency of calls to the scroll event handler. How can I achieve this
| without using a messagebox.
|
| > You didn't provide the code of method FetchNextChunk, I'm not sure if
| > there is some racing condition problems between threads.
|
| FetchNextChunk is a method which calls a webservice which returns the
next
| chunk of data (using Dime) and puts it into a dataset (this.dsNew). It
then
| sets this.chunkFetch = false.
|
| > And I also noticed you have an if statement before doing the waiting
| > loop( while(this.chunkFetch)). I'm not clear if there are any chances
that
| > the if statement will not meet when a thread is running.
|
| for this test i think its okay.
|
| I would appreciate any further feedback.
| thanks
|
|
|
 
Hi Ying-Shen,
To answer some of your questions,
1) this is debug output from slow scrolling (I pressed the down arrow key).
Everything is okay

2003-09-08 08:43:49:977 client:getdata_button clicked- start first fetch
2003-09-08 08:43:50:018 server-main method: start
2003-09-08 08:43:51:359 server-main method: end
2003-09-08 08:43:52:261 client: getdata_button clicked- end first fetch
2003-09-08 08:43:56:106 **3rd if test** (datagrid scroll event)
2003-09-08 08:43:56:186 client: fetchnextchunk method start
2003-09-08 08:43:56:236 server-main method: start fetch method
2003-09-08 08:43:56:257 server-main method: end
2003-09-08 08:43:56:677 client: fetchnextchunk method end
2003-09-08 08:43:56:697 **2nd if test** (datagrid scroll event)
2003-09-08 08:44:23:636 **3rd if test** (datagrid scroll event)
2003-09-08 08:44:23:656 client: fetchnextchunk method start
2003-09-08 08:44:23:706 server-main method: start fetch method
2003-09-08 08:44:23:726 server-main method: end
2003-09-08 08:44:24:056 client: fetchnextchunk method end
2003-09-08 08:44:24:077 **2nd if test** (datagrid scroll event)
......
-----------------------------------------------------------------------
2) output from dragging scroll bar from top to bottom of datagrid as quickly
as possible (application freezes)

2003-09-08 09:01:13:708 client:getdata_button clicked- start first fetch
2003-09-08 09:01:13:748 server-main method: start
2003-09-08 09:01:15:060 server-main method: end
2003-09-08 09:01:15:942 client: getdata_button clicked- end first fetch
2003-09-08 09:01:19:457 **3rd if test** (datagrid scroll event)
2003-09-08 09:01:19:487 **1st if test** (datagrid scroll event)
2003-09-08 09:01:19:497 main thread sleep (datagrid scroll event 1st if
test)
2003-09-08 09:01:19:537 client: fetchnextchunk method start
2003-09-08 09:01:19:547 fetchnextchunk method: ws instance created
2003-09-08 09:01:19:757 main thread sleep
2003-09-08 09:01:20:007 main thread sleep
2003-09-08 09:01:20:258 main thread sleep
2003-09-08 09:01:20:518 main thread sleep
(the above line "main thread sleep" is output continuously until i stop
application)
.....
-----------------
As you can see from the event log, 2 lines of the FetchNextChunk method
instructions are completed but after that, nothing happens (i.e. doesnt
reach server method ProcessMessage)

this is the fetch next chunk method.
private void FetchNextChunk()
{
this.WriteEventLog("client: fetchnextchunk method start");
myWebService ws = new TestBed.localhost1.myWebService();

this.WriteEventLog("fetchnextchunk method: ws instance created");
string s1 = ws.ProcessMessage("fetch", (this.chunkLast + 1).ToString());

this.WriteEventLog("fetchnextchunk method: ws-method called");
Stream sourcestream = ws.ResponseSoapContext.Attachments[0].Stream;
....
this.fetchChunk = false;
}

thanks for your help.
 
Hi hs,
Thanks for your quick reply, and your trace log is very helpful. From
this log, we can see the execution route is different in the two cases.
We can see in the slow trace log, the correct order is 3rd if block,
2nd if block executed sequently.
while in the fast trace log, it's order is 3,1.....,, . The 2nd event
didn't execute, the 1 event executed instead.
and it's a dead loop without processing any windows message. It seems that
you implementation of the ProcessMessage method called some functions that
depend on the message loop(any UI operation in it?).
You need check it.
the second point is , The two route is different, is it correct in your
design? I'm not sure if we should be in the 1st block at that time.
the third point, If my assumption is wrong, the implementation of
ProcessMessage is not depending on the MessageLoop, then you should check
the relation between your 2nd if block code and the ProcessMessage
implementation. If you are not sure, post the code and I'll help you.

another trivial thing, these two trace log is not generated by the same
version of code. the first log seems a bit different with the code you
give me. and I'd like to have your e-mail address, then I can send you an
Notification mail when I replied your post, you may send a mail to me, my
e-mail address is
(e-mail address removed) ('online.' should be removed before sending).
Thanks!

Kind regards,

Ying-Shen Yu [MS]
Microsoft Support Engineer

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. 2001 Microsoft Corporation. All rights
reserved.
--------------------
| Reply-To: "hs" <[email protected]>
| From: "hs" <[email protected]>
| References: <[email protected]>
<J#[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: datagrid scrolling/ threading problem
| Date: Mon, 8 Sep 2003 12:16:08 +0100
| Lines: 66
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| NNTP-Posting-Host: mailgate.synergy-logistics.co.uk 62.49.130.162
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:51856
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
|
| Hi Ying-Shen,
| To answer some of your questions,
| 1) this is debug output from slow scrolling (I pressed the down arrow
key).
| Everything is okay
|
| 2003-09-08 08:43:49:977 client:getdata_button clicked- start first
fetch
| 2003-09-08 08:43:50:018 server-main method: start
| 2003-09-08 08:43:51:359 server-main method: end
| 2003-09-08 08:43:52:261 client: getdata_button clicked- end first fetch
| 2003-09-08 08:43:56:106 **3rd if test** (datagrid scroll event)
| 2003-09-08 08:43:56:186 client: fetchnextchunk method start
| 2003-09-08 08:43:56:236 server-main method: start fetch method
| 2003-09-08 08:43:56:257 server-main method: end
| 2003-09-08 08:43:56:677 client: fetchnextchunk method end
| 2003-09-08 08:43:56:697 **2nd if test** (datagrid scroll event)
| 2003-09-08 08:44:23:636 **3rd if test** (datagrid scroll event)
| 2003-09-08 08:44:23:656 client: fetchnextchunk method start
| 2003-09-08 08:44:23:706 server-main method: start fetch method
| 2003-09-08 08:44:23:726 server-main method: end
| 2003-09-08 08:44:24:056 client: fetchnextchunk method end
| 2003-09-08 08:44:24:077 **2nd if test** (datagrid scroll event)
| .....
| -----------------------------------------------------------------------
| 2) output from dragging scroll bar from top to bottom of datagrid as
quickly
| as possible (application freezes)
|
| 2003-09-08 09:01:13:708 client:getdata_button clicked- start first
fetch
| 2003-09-08 09:01:13:748 server-main method: start
| 2003-09-08 09:01:15:060 server-main method: end
| 2003-09-08 09:01:15:942 client: getdata_button clicked- end first fetch
| 2003-09-08 09:01:19:457 **3rd if test** (datagrid scroll event)
| 2003-09-08 09:01:19:487 **1st if test** (datagrid scroll event)
| 2003-09-08 09:01:19:497 main thread sleep (datagrid scroll event 1st
if
| test)
| 2003-09-08 09:01:19:537 client: fetchnextchunk method start
| 2003-09-08 09:01:19:547 fetchnextchunk method: ws instance created
| 2003-09-08 09:01:19:757 main thread sleep
| 2003-09-08 09:01:20:007 main thread sleep
| 2003-09-08 09:01:20:258 main thread sleep
| 2003-09-08 09:01:20:518 main thread sleep
| (the above line "main thread sleep" is output continuously until i stop
| application)
| ....
| -----------------
| As you can see from the event log, 2 lines of the FetchNextChunk method
| instructions are completed but after that, nothing happens (i.e. doesnt
| reach server method ProcessMessage)
|
| this is the fetch next chunk method.
| private void FetchNextChunk()
| {
| this.WriteEventLog("client: fetchnextchunk method start");
| myWebService ws = new TestBed.localhost1.myWebService();
|
| this.WriteEventLog("fetchnextchunk method: ws instance created");
| string s1 = ws.ProcessMessage("fetch", (this.chunkLast +
1).ToString());
|
| this.WriteEventLog("fetchnextchunk method: ws-method called");
| Stream sourcestream = ws.ResponseSoapContext.Attachments[0].Stream;
| ....
| this.fetchChunk = false;
| }
|
| thanks for your help.
|
|
|
 
Hi Ying-Shen
My code is in a testbed project, so i sent the most important parts. but
yes, its not going in the right order for both test. i'll send you a more
detail, and i appreciate your help.


Ying-Shen Yu said:
Hi hs,
Thanks for your quick reply, and your trace log is very helpful. From
this log, we can see the execution route is different in the two cases.
We can see in the slow trace log, the correct order is 3rd if block,
2nd if block executed sequently.
while in the fast trace log, it's order is 3,1.....,, . The 2nd event
didn't execute, the 1 event executed instead.
and it's a dead loop without processing any windows message. It seems that
you implementation of the ProcessMessage method called some functions that
depend on the message loop(any UI operation in it?).
You need check it.
the second point is , The two route is different, is it correct in your
design? I'm not sure if we should be in the 1st block at that time.
the third point, If my assumption is wrong, the implementation of
ProcessMessage is not depending on the MessageLoop, then you should check
the relation between your 2nd if block code and the ProcessMessage
implementation. If you are not sure, post the code and I'll help you.

another trivial thing, these two trace log is not generated by the same
version of code. the first log seems a bit different with the code you
give me. and I'd like to have your e-mail address, then I can send you an
Notification mail when I replied your post, you may send a mail to me, my
e-mail address is
(e-mail address removed) ('online.' should be removed before sending).
Thanks!

Kind regards,

Ying-Shen Yu [MS]
Microsoft Support Engineer

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. 2001 Microsoft Corporation. All rights
reserved.
--------------------
| Reply-To: "hs" <[email protected]>
| From: "hs" <[email protected]>
| References: <[email protected]>
<J#[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: datagrid scrolling/ threading problem
| Date: Mon, 8 Sep 2003 12:16:08 +0100
| Lines: 66
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| NNTP-Posting-Host: mailgate.synergy-logistics.co.uk 62.49.130.162
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:51856
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
|
| Hi Ying-Shen,
| To answer some of your questions,
| 1) this is debug output from slow scrolling (I pressed the down arrow
key).
| Everything is okay
|
| 2003-09-08 08:43:49:977 client:getdata_button clicked- start first
fetch
| 2003-09-08 08:43:50:018 server-main method: start
| 2003-09-08 08:43:51:359 server-main method: end
| 2003-09-08 08:43:52:261 client: getdata_button clicked- end first fetch
| 2003-09-08 08:43:56:106 **3rd if test** (datagrid scroll event)
| 2003-09-08 08:43:56:186 client: fetchnextchunk method start
| 2003-09-08 08:43:56:236 server-main method: start fetch method
| 2003-09-08 08:43:56:257 server-main method: end
| 2003-09-08 08:43:56:677 client: fetchnextchunk method end
| 2003-09-08 08:43:56:697 **2nd if test** (datagrid scroll event)
| 2003-09-08 08:44:23:636 **3rd if test** (datagrid scroll event)
| 2003-09-08 08:44:23:656 client: fetchnextchunk method start
| 2003-09-08 08:44:23:706 server-main method: start fetch method
| 2003-09-08 08:44:23:726 server-main method: end
| 2003-09-08 08:44:24:056 client: fetchnextchunk method end
| 2003-09-08 08:44:24:077 **2nd if test** (datagrid scroll event)
| .....
| -----------------------------------------------------------------------
| 2) output from dragging scroll bar from top to bottom of datagrid as
quickly
| as possible (application freezes)
|
| 2003-09-08 09:01:13:708 client:getdata_button clicked- start first
fetch
| 2003-09-08 09:01:13:748 server-main method: start
| 2003-09-08 09:01:15:060 server-main method: end
| 2003-09-08 09:01:15:942 client: getdata_button clicked- end first fetch
| 2003-09-08 09:01:19:457 **3rd if test** (datagrid scroll event)
| 2003-09-08 09:01:19:487 **1st if test** (datagrid scroll event)
| 2003-09-08 09:01:19:497 main thread sleep (datagrid scroll event 1st
if
| test)
| 2003-09-08 09:01:19:537 client: fetchnextchunk method start
| 2003-09-08 09:01:19:547 fetchnextchunk method: ws instance created
| 2003-09-08 09:01:19:757 main thread sleep
| 2003-09-08 09:01:20:007 main thread sleep
| 2003-09-08 09:01:20:258 main thread sleep
| 2003-09-08 09:01:20:518 main thread sleep
| (the above line "main thread sleep" is output continuously until i stop
| application)
| ....
| -----------------
| As you can see from the event log, 2 lines of the FetchNextChunk method
| instructions are completed but after that, nothing happens (i.e. doesnt
| reach server method ProcessMessage)
|
| this is the fetch next chunk method.
| private void FetchNextChunk()
| {
| this.WriteEventLog("client: fetchnextchunk method start");
| myWebService ws = new TestBed.localhost1.myWebService();
|
| this.WriteEventLog("fetchnextchunk method: ws instance created");
| string s1 = ws.ProcessMessage("fetch", (this.chunkLast +
1).ToString());
|
| this.WriteEventLog("fetchnextchunk method: ws-method called");
| Stream sourcestream = ws.ResponseSoapContext.Attachments[0].Stream;
| ....
| this.fetchChunk = false;
| }
|
| thanks for your help.
|
|
|
 
Hi hs,
You didn't give me the tracelog of the ProcessMessage method, I need it to
analyze the code execution, thanks!

Kind regards,

Ying-Shen Yu [MS]
Microsoft Support Engineer

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. 2001 Microsoft Corporation. All rights
reserved.
--------------------
| Reply-To: "hs" <[email protected]>
| From: "hs" <[email protected]>
| References: <[email protected]>
<J#[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: datagrid scrolling/ threading problem
| Date: Mon, 8 Sep 2003 16:27:20 +0100
| Lines: 145
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| NNTP-Posting-Host: mailgate.synergy-logistics.co.uk 62.49.130.162
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:51880
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
|
| Hi Ying-Shen
| My code is in a testbed project, so i sent the most important parts. but
| yes, its not going in the right order for both test. i'll send you a more
| detail, and i appreciate your help.
|
|
| | > Hi hs,
| > Thanks for your quick reply, and your trace log is very helpful.
From
| > this log, we can see the execution route is different in the two cases.
| > We can see in the slow trace log, the correct order is 3rd if block,
| > 2nd if block executed sequently.
| > while in the fast trace log, it's order is 3,1.....,, . The 2nd event
| > didn't execute, the 1 event executed instead.
| > and it's a dead loop without processing any windows message. It seems
that
| > you implementation of the ProcessMessage method called some functions
| that
| > depend on the message loop(any UI operation in it?).
| > You need check it.
| > the second point is , The two route is different, is it correct in
| your
| > design? I'm not sure if we should be in the 1st block at that time.
| > the third point, If my assumption is wrong, the implementation of
| > ProcessMessage is not depending on the MessageLoop, then you should
check
| > the relation between your 2nd if block code and the ProcessMessage
| > implementation. If you are not sure, post the code and I'll help you.
| >
| > another trivial thing, these two trace log is not generated by the
same
| > version of code. the first log seems a bit different with the code you
| > give me. and I'd like to have your e-mail address, then I can send you
an
| > Notification mail when I replied your post, you may send a mail to me,
my
| > e-mail address is
| > (e-mail address removed) ('online.' should be removed before sending).
| > Thanks!
| >
| > Kind regards,
| >
| > Ying-Shen Yu [MS]
| > Microsoft Support Engineer
| >
| > This posting is provided "AS IS" with no warranties, and confers no
| rights.
| > You assume all risk for your use. 2001 Microsoft Corporation. All
rights
| > reserved.
| > --------------------
| > | Reply-To: "hs" <[email protected]>
| > | From: "hs" <[email protected]>
| > | References: <[email protected]>
| > <J#[email protected]>
| > <[email protected]>
| > <[email protected]>
| > | Subject: Re: datagrid scrolling/ threading problem
| > | Date: Mon, 8 Sep 2003 12:16:08 +0100
| > | Lines: 66
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | Message-ID: <[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.windowsforms
| > | NNTP-Posting-Host: mailgate.synergy-logistics.co.uk 62.49.130.162
| > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| > | Xref: cpmsftngxa06.phx.gbl
| > microsoft.public.dotnet.framework.windowsforms:51856
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
| > |
| > | Hi Ying-Shen,
| > | To answer some of your questions,
| > | 1) this is debug output from slow scrolling (I pressed the down arrow
| > key).
| > | Everything is okay
| > |
| > | 2003-09-08 08:43:49:977 client:getdata_button clicked- start first
| > fetch
| > | 2003-09-08 08:43:50:018 server-main method: start
| > | 2003-09-08 08:43:51:359 server-main method: end
| > | 2003-09-08 08:43:52:261 client: getdata_button clicked- end first
| fetch
| > | 2003-09-08 08:43:56:106 **3rd if test** (datagrid scroll event)
| > | 2003-09-08 08:43:56:186 client: fetchnextchunk method start
| > | 2003-09-08 08:43:56:236 server-main method: start fetch method
| > | 2003-09-08 08:43:56:257 server-main method: end
| > | 2003-09-08 08:43:56:677 client: fetchnextchunk method end
| > | 2003-09-08 08:43:56:697 **2nd if test** (datagrid scroll event)
| > | 2003-09-08 08:44:23:636 **3rd if test** (datagrid scroll event)
| > | 2003-09-08 08:44:23:656 client: fetchnextchunk method start
| > | 2003-09-08 08:44:23:706 server-main method: start fetch method
| > | 2003-09-08 08:44:23:726 server-main method: end
| > | 2003-09-08 08:44:24:056 client: fetchnextchunk method end
| > | 2003-09-08 08:44:24:077 **2nd if test** (datagrid scroll event)
| > | .....
| > |
-----------------------------------------------------------------------
| > | 2) output from dragging scroll bar from top to bottom of datagrid as
| > quickly
| > | as possible (application freezes)
| > |
| > | 2003-09-08 09:01:13:708 client:getdata_button clicked- start first
| > fetch
| > | 2003-09-08 09:01:13:748 server-main method: start
| > | 2003-09-08 09:01:15:060 server-main method: end
| > | 2003-09-08 09:01:15:942 client: getdata_button clicked- end first
| fetch
| > | 2003-09-08 09:01:19:457 **3rd if test** (datagrid scroll event)
| > | 2003-09-08 09:01:19:487 **1st if test** (datagrid scroll event)
| > | 2003-09-08 09:01:19:497 main thread sleep (datagrid scroll event
1st
| > if
| > | test)
| > | 2003-09-08 09:01:19:537 client: fetchnextchunk method start
| > | 2003-09-08 09:01:19:547 fetchnextchunk method: ws instance created
| > | 2003-09-08 09:01:19:757 main thread sleep
| > | 2003-09-08 09:01:20:007 main thread sleep
| > | 2003-09-08 09:01:20:258 main thread sleep
| > | 2003-09-08 09:01:20:518 main thread sleep
| > | (the above line "main thread sleep" is output continuously until i
stop
| > | application)
| > | ....
| > | -----------------
| > | As you can see from the event log, 2 lines of the FetchNextChunk
method
| > | instructions are completed but after that, nothing happens (i.e.
doesnt
| > | reach server method ProcessMessage)
| > |
| > | this is the fetch next chunk method.
| > | private void FetchNextChunk()
| > | {
| > | this.WriteEventLog("client: fetchnextchunk method start");
| > | myWebService ws = new TestBed.localhost1.myWebService();
| > |
| > | this.WriteEventLog("fetchnextchunk method: ws instance created");
| > | string s1 = ws.ProcessMessage("fetch", (this.chunkLast +
| > 1).ToString());
| > |
| > | this.WriteEventLog("fetchnextchunk method: ws-method called");
| > | Stream sourcestream =
ws.ResponseSoapContext.Attachments[0].Stream;
| > | ....
| > | this.fetchChunk = false;
| > | }
| > |
| > | thanks for your help.
| > |
| > |
| > |
| >
|
|
|
 
Hi Ying-Shen
Sorry about the delay in response. I think my working day ends when yours is
about to start.
I took out some of the original trace to make it simpler to read. Here it is
again (ProcessMessage traces begin with"server-main method").
button1_click gets the first 250 records (GetMyDataTable250 method) and the
datagrid scrolling gets the remaining records (in 4 chunks.....each chunk
has a maximum of 750 records).
thanks once again

1)Trace for slow scrolling ...works fine.
2003-09-09 07:59:47:687 client: start
2003-09-09 07:59:47:788 server-main method: start
2003-09-09 07:59:48:849 server-main method: datatable fill complete
2003-09-09 07:59:48:879 server-main method: more than 250 records found
2003-09-09 07:59:48:949 server-main method: return from
CreateCompressedMyDataTable
2003-09-09 07:59:48:979 server-main method: dime attachment added
2003-09-09 07:59:49:049 client: server end
2003-09-09 07:59:49:109 client: end decompression
2003-09-09 07:59:49:290 client: MyDataTable deserialization complete
2003-09-09 07:59:49:670 client: end
2003-09-09 07:59:57:892 **3rd if test**
2003-09-09 07:59:57:942 client: fetchnextchunk method start
2003-09-09 07:59:57:952 fetchnextchunk method: ws instance created
2003-09-09 07:59:58:032 server-main method: start fetch
2003-09-09 07:59:58:042 server-main method: dime attchment added
2003-09-09 07:59:58:062 fetchnextchunk method: ws-method called
2003-09-09 07:59:58:072 fetchnextchunk method: dime streamed
2003-09-09 07:59:58:102 client: end decompression
2003-09-09 07:59:58:283 client: MyDataTable deserialization completed
2003-09-09 07:59:58:303 client: fetchnextchunk method end
2003-09-09 07:59:58:353 **2nd if test**
2003-09-09 08:00:10:250 **3rd if test**
2003-09-09 08:00:10:270 client: fetchnextchunk method start
2003-09-09 08:00:10:290 fetchnextchunk method: ws instance created
2003-09-09 08:00:10:330 server-main method: start fetch
2003-09-09 08:00:10:340 server-main method: dime attchment added
2003-09-09 08:00:10:380 fetchnextchunk method: ws-method called
2003-09-09 08:00:10:390 fetchnextchunk method: dime streamed
2003-09-09 08:00:10:430 client: end decompression
2003-09-09 08:00:10:660 client: MyDataTable deserialization completed
2003-09-09 08:00:10:670 client: fetchnextchunk method end
2003-09-09 08:00:10:690 **2nd if test**
2003-09-09 08:00:17:961 **3rd if test**
2003-09-09 08:00:17:981 client: fetchnextchunk method start
2003-09-09 08:00:18:001 fetchnextchunk method: ws instance created
2003-09-09 08:00:18:041 server-main method: start fetch
2003-09-09 08:00:18:071 server-main method: dime attchment added
2003-09-09 08:00:18:101 fetchnextchunk method: ws-method called
2003-09-09 08:00:18:131 fetchnextchunk method: dime streamed
2003-09-09 08:00:18:151 client: end decompression
2003-09-09 08:00:18:392 client: MyDataTable deserialization completed
2003-09-09 08:00:18:402 client: fetchnextchunk method end
2003-09-09 08:00:18:422 **2nd if test**
2003-09-09 08:00:25:622 **3rd if test**
2003-09-09 08:00:25:642 client: fetchnextchunk method start
2003-09-09 08:00:25:662 fetchnextchunk method: ws instance created
2003-09-09 08:00:25:702 server-main method: start fetch
2003-09-09 08:00:25:712 server-main method: dime attchment added
2003-09-09 08:00:25:752 fetchnextchunk method: ws-method called
2003-09-09 08:00:25:762 fetchnextchunk method: dime streamed
2003-09-09 08:00:25:792 client: end decompression
2003-09-09 08:00:25:952 client: MyDataTable deserialization completed
2003-09-09 08:00:25:982 client: fetchnextchunk method end
2003-09-09 08:00:26:023 **2nd if test**


2)Trace for fast scrolling (ie drag vscroll down to bottom of datagrid
quickly)...freezing
2003-09-09 07:37:46:468 client: start
2003-09-09 07:37:46:588 server-main method: start
2003-09-09 07:37:47:749 server-main method: datatable fill complete
2003-09-09 07:37:47:789 server-main method: more than 250 records found
2003-09-09 07:37:47:980 server-main method: return from
CreateCompressedMyDataTable
2003-09-09 07:37:48:000 server-main method: dime attachment added
2003-09-09 07:37:48:130 client: server end
2003-09-09 07:37:48:250 client: end decompression
2003-09-09 07:37:48:601 client: MyDataTable deserialization complete
2003-09-09 07:37:49:011 client: end
2003-09-09 07:37:55:010 **3rd if test**
2003-09-09 07:37:55:100 **1st if test**
2003-09-09 07:37:55:100 main thread sleep
2003-09-09 07:37:55:110 client: fetchnextchunk method start
2003-09-09 07:37:55:140 fetchnextchunk method: ws instance created
2003-09-09 07:37:55:360 main thread sleep
2003-09-09 07:37:55:611 main thread sleep
2003-09-09 07:37:55:861 main thread sleep
2003-09-09 07:37:56:121 main thread sleep
2003-09-09 07:37:56:372 main thread sleep
2003-09-09 07:37:56:622 main thread sleep
2003-09-09 07:37:56:873 main thread sleep
2003-09-09 07:37:57:133 main thread sleep
2003-09-09 07:37:57:393 main thread sleep
2003-09-09 07:37:57:654 main thread sleep
2003-09-09 07:37:57:914 main thread sleep
2003-09-09 07:37:58:174 main thread sleep
2003-09-09 07:37:58:435 main thread sleep
2003-09-09 07:37:58:695 main thread sleep
2003-09-09 07:37:58:956 main thread sleep
2003-09-09 07:37:59:216 main thread sleep
2003-09-09 07:37:59:476 main thread sleep
2003-09-09 07:37:59:737 main thread sleep
2003-09-09 07:37:59:997 main thread sleep
2003-09-09 07:38:00:257 main thread sleep
2003-09-09 07:38:00:518 main thread sleep
2003-09-09 07:38:00:788 main thread sleep
2003-09-09 07:38:01:049 main thread sleep
2003-09-09 07:38:01:309 main thread sleep
2003-09-09 07:38:01:569 main thread sleep
2003-09-09 07:38:01:830 main thread sleep
2003-09-09 07:38:02:090 main thread sleep
2003-09-09 07:38:02:350 main thread sleep
2003-09-09 07:38:02:611 main thread sleep
2003-09-09 07:38:02:871 main thread sleep
2003-09-09 07:38:03:132 main thread sleep
2003-09-09 07:38:03:392 main thread sleep
2003-09-09 07:38:03:652 main thread sleep
2003-09-09 07:38:03:913 main thread sleep
etc
 
Hi Hugh,
I'm investigating on your code and trace log. By comparing the two
trace logs, we can clear see the thread is hanging at calling the
wse.ProcessMessage method, but it didn't entered the method.
It's really a strange problem, because it's an webservice method, .NET
Framework has done a lot under hood. So I guess it maybe use some methods
which will invoke the main thread (you main thread is sleeping , right?).
Can you try removing the while(){ ... sleep(250)} block? Is it ok to
just return to skip handling the event?
This maybe helpful, but I'm not sure if your program logic allow you to do
so. If this will break the logic of your program, you may try your own
method to remove the while loop and let me know your change.


I'll wait for your result, thanks!



Kind regards,

Ying-Shen Yu [MS]
Microsoft Support Engineer

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. 2001 Microsoft Corporation. All rights
reserved.
--------------------
| Reply-To: "hs" <[email protected]>
| From: "hs" <[email protected]>
| References: <[email protected]>
<J#[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: datagrid scrolling/ threading problem
| Date: Tue, 9 Sep 2003 09:13:22 +0100
| Lines: 123
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| NNTP-Posting-Host: mailgate.synergy-logistics.co.uk 62.49.130.162
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:51920
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
|
| Hi Ying-Shen
| Sorry about the delay in response. I think my working day ends when yours
is
| about to start.
| I took out some of the original trace to make it simpler to read. Here it
is
| again (ProcessMessage traces begin with"server-main method").
| button1_click gets the first 250 records (GetMyDataTable250 method) and
the
| datagrid scrolling gets the remaining records (in 4 chunks.....each chunk
| has a maximum of 750 records).
| thanks once again
|
| 1)Trace for slow scrolling ...works fine.
| 2003-09-09 07:59:47:687 client: start
| 2003-09-09 07:59:47:788 server-main method: start
| 2003-09-09 07:59:48:849 server-main method: datatable fill complete
| 2003-09-09 07:59:48:879 server-main method: more than 250 records found
| 2003-09-09 07:59:48:949 server-main method: return from
| CreateCompressedMyDataTable
| 2003-09-09 07:59:48:979 server-main method: dime attachment added
| 2003-09-09 07:59:49:049 client: server end
| 2003-09-09 07:59:49:109 client: end decompression
| 2003-09-09 07:59:49:290 client: MyDataTable deserialization complete
| 2003-09-09 07:59:49:670 client: end
| 2003-09-09 07:59:57:892 **3rd if test**
| 2003-09-09 07:59:57:942 client: fetchnextchunk method start
| 2003-09-09 07:59:57:952 fetchnextchunk method: ws instance created
| 2003-09-09 07:59:58:032 server-main method: start fetch
| 2003-09-09 07:59:58:042 server-main method: dime attchment added
| 2003-09-09 07:59:58:062 fetchnextchunk method: ws-method called
| 2003-09-09 07:59:58:072 fetchnextchunk method: dime streamed
| 2003-09-09 07:59:58:102 client: end decompression
| 2003-09-09 07:59:58:283 client: MyDataTable deserialization completed
| 2003-09-09 07:59:58:303 client: fetchnextchunk method end
| 2003-09-09 07:59:58:353 **2nd if test**
| 2003-09-09 08:00:10:250 **3rd if test**
| 2003-09-09 08:00:10:270 client: fetchnextchunk method start
| 2003-09-09 08:00:10:290 fetchnextchunk method: ws instance created
| 2003-09-09 08:00:10:330 server-main method: start fetch
| 2003-09-09 08:00:10:340 server-main method: dime attchment added
| 2003-09-09 08:00:10:380 fetchnextchunk method: ws-method called
| 2003-09-09 08:00:10:390 fetchnextchunk method: dime streamed
| 2003-09-09 08:00:10:430 client: end decompression
| 2003-09-09 08:00:10:660 client: MyDataTable deserialization completed
| 2003-09-09 08:00:10:670 client: fetchnextchunk method end
| 2003-09-09 08:00:10:690 **2nd if test**
| 2003-09-09 08:00:17:961 **3rd if test**
| 2003-09-09 08:00:17:981 client: fetchnextchunk method start
| 2003-09-09 08:00:18:001 fetchnextchunk method: ws instance created
| 2003-09-09 08:00:18:041 server-main method: start fetch
| 2003-09-09 08:00:18:071 server-main method: dime attchment added
| 2003-09-09 08:00:18:101 fetchnextchunk method: ws-method called
| 2003-09-09 08:00:18:131 fetchnextchunk method: dime streamed
| 2003-09-09 08:00:18:151 client: end decompression
| 2003-09-09 08:00:18:392 client: MyDataTable deserialization completed
| 2003-09-09 08:00:18:402 client: fetchnextchunk method end
| 2003-09-09 08:00:18:422 **2nd if test**
| 2003-09-09 08:00:25:622 **3rd if test**
| 2003-09-09 08:00:25:642 client: fetchnextchunk method start
| 2003-09-09 08:00:25:662 fetchnextchunk method: ws instance created
| 2003-09-09 08:00:25:702 server-main method: start fetch
| 2003-09-09 08:00:25:712 server-main method: dime attchment added
| 2003-09-09 08:00:25:752 fetchnextchunk method: ws-method called
| 2003-09-09 08:00:25:762 fetchnextchunk method: dime streamed
| 2003-09-09 08:00:25:792 client: end decompression
| 2003-09-09 08:00:25:952 client: MyDataTable deserialization completed
| 2003-09-09 08:00:25:982 client: fetchnextchunk method end
| 2003-09-09 08:00:26:023 **2nd if test**
|
|
| 2)Trace for fast scrolling (ie drag vscroll down to bottom of datagrid
| quickly)...freezing
| 2003-09-09 07:37:46:468 client: start
| 2003-09-09 07:37:46:588 server-main method: start
| 2003-09-09 07:37:47:749 server-main method: datatable fill complete
| 2003-09-09 07:37:47:789 server-main method: more than 250 records found
| 2003-09-09 07:37:47:980 server-main method: return from
| CreateCompressedMyDataTable
| 2003-09-09 07:37:48:000 server-main method: dime attachment added
| 2003-09-09 07:37:48:130 client: server end
| 2003-09-09 07:37:48:250 client: end decompression
| 2003-09-09 07:37:48:601 client: MyDataTable deserialization complete
| 2003-09-09 07:37:49:011 client: end
| 2003-09-09 07:37:55:010 **3rd if test**
| 2003-09-09 07:37:55:100 **1st if test**
| 2003-09-09 07:37:55:100 main thread sleep
| 2003-09-09 07:37:55:110 client: fetchnextchunk method start
| 2003-09-09 07:37:55:140 fetchnextchunk method: ws instance created
| 2003-09-09 07:37:55:360 main thread sleep
| 2003-09-09 07:37:55:611 main thread sleep
| 2003-09-09 07:37:55:861 main thread sleep
| 2003-09-09 07:37:56:121 main thread sleep
| 2003-09-09 07:37:56:372 main thread sleep
| 2003-09-09 07:37:56:622 main thread sleep
| 2003-09-09 07:37:56:873 main thread sleep
| 2003-09-09 07:37:57:133 main thread sleep
| 2003-09-09 07:37:57:393 main thread sleep
| 2003-09-09 07:37:57:654 main thread sleep
| 2003-09-09 07:37:57:914 main thread sleep
| 2003-09-09 07:37:58:174 main thread sleep
| 2003-09-09 07:37:58:435 main thread sleep
| 2003-09-09 07:37:58:695 main thread sleep
| 2003-09-09 07:37:58:956 main thread sleep
| 2003-09-09 07:37:59:216 main thread sleep
| 2003-09-09 07:37:59:476 main thread sleep
| 2003-09-09 07:37:59:737 main thread sleep
| 2003-09-09 07:37:59:997 main thread sleep
| 2003-09-09 07:38:00:257 main thread sleep
| 2003-09-09 07:38:00:518 main thread sleep
| 2003-09-09 07:38:00:788 main thread sleep
| 2003-09-09 07:38:01:049 main thread sleep
| 2003-09-09 07:38:01:309 main thread sleep
| 2003-09-09 07:38:01:569 main thread sleep
| 2003-09-09 07:38:01:830 main thread sleep
| 2003-09-09 07:38:02:090 main thread sleep
| 2003-09-09 07:38:02:350 main thread sleep
| 2003-09-09 07:38:02:611 main thread sleep
| 2003-09-09 07:38:02:871 main thread sleep
| 2003-09-09 07:38:03:132 main thread sleep
| 2003-09-09 07:38:03:392 main thread sleep
| 2003-09-09 07:38:03:652 main thread sleep
| 2003-09-09 07:38:03:913 main thread sleep
| etc
|
|
|
 
Hi Ying-Shen,
Thanks for your help again. I replaced : -
while(this.chunkFetch)
{
Thread.Sleep(250);
}

with
while(this.chunkFetch)
{
return;
}

My application doesn't freeze anymore and the webservice method to retrieve
more data is called.
However, the vscroll bar isn't being refreshed. I expect the scroll bar to
go up again (like when you look at a very large datatable in visual
studio.net via server explorer....if you drag the vscroll bar down to
bottom, it goes up again)
I hope i am clear.
thanks
 
Hi kevin,
I'm afraid I'm not fully understand this behaviour, and I think you
should tell me more about
the current phenomenon, maybe you can send me some screen-shots(both
problem and the expectation) by mail. Thanks a lot!

Kind regards,

Ying-Shen Yu [MS]
Microsoft Support Engineer

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. 2001 Microsoft Corporation. All rights
reserved.
--------------------
| Reply-To: "hs" <[email protected]>
| From: "hs" <[email protected]>
| References: <[email protected]>
<J#[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<#[email protected]>
<[email protected]>
| Subject: Re: datagrid scrolling/ threading problem
| Date: Tue, 9 Sep 2003 15:31:29 +0100
| Lines: 23
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| NNTP-Posting-Host: mailgate.synergy-logistics.co.uk 62.49.130.162
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:51946
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
|
| Hi Ying-Shen,
| Thanks for your help again. I replaced : -
| while(this.chunkFetch)
| {
| Thread.Sleep(250);
| }
|
| with
| while(this.chunkFetch)
| {
| return;
| }
|
| My application doesn't freeze anymore and the webservice method to
retrieve
| more data is called.
| However, the vscroll bar isn't being refreshed. I expect the scroll bar to
| go up again (like when you look at a very large datatable in visual
| studio.net via server explorer....if you drag the vscroll bar down to
| bottom, it goes up again)
| I hope i am clear.
| thanks
|
|
|
 
Hello Hugh,
Sorry for the delay, I've read your mail. the reason why the scrollbar
range didn't extended is the dataset merge didn't be called when you scroll
down fast.
It's not good to make your merge depending on the scroll event , you
see, it should depend on your data arrival. You may do merge after you got
the newDataset. Then I think you can get your expected result.

Thanks!

Best regards,

Ying-Shen Yu [MS]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Reply-To: "hs" <[email protected]>
| From: "hs" <[email protected]>
| References: <[email protected]>
<J#[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<#[email protected]>
<[email protected]>
| Subject: Re: datagrid scrolling/ threading problem
| Date: Tue, 9 Sep 2003 15:31:29 +0100
| Lines: 23
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| NNTP-Posting-Host: mailgate.synergy-logistics.co.uk 62.49.130.162
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:51946
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
|
| Hi Ying-Shen,
| Thanks for your help again. I replaced : -
| while(this.chunkFetch)
| {
| Thread.Sleep(250);
| }
|
| with
| while(this.chunkFetch)
| {
| return;
| }
|
| My application doesn't freeze anymore and the webservice method to
retrieve
| more data is called.
| However, the vscroll bar isn't being refreshed. I expect the scroll bar to
| go up again (like when you look at a very large datatable in visual
| studio.net via server explorer....if you drag the vscroll bar down to
| bottom, it goes up again)
| I hope i am clear.
| thanks
|
|
|
 
Hi Ying-Shen
It's not good to make your merge depending on the scroll event , you
see, it should depend on your data arrival. You may do merge after you got
the newDataset. Then I think you can get your expected result.

I actually tried that but what happens is i get 2 vscroll bars (and 2
hscroll bars) appearing.
I think thats something to do with the newDataset being created on a thread.
(not the main thread). Is this true?
i wait for your reply
thanks.
 
Hi Hugh,
Have you tried using the invoke method to let the main thread do UI
Updating?
We unblocked the main thread right?
Just define a delegate method and put your dataset merge code into it. then
call the Invoke method
after you got the new dataset.
For more informatoin on how to use the Invoke method, you may refer to
ms-help://MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystemWindowsFormsControlC
lassInvokeTopic.htm

Thanks!, If you still have problem on this issue, please let me know!



Best regards,

Ying-Shen Yu [MS]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Reply-To: "hs" <[email protected]>
| From: "hs" <[email protected]>
| References: <[email protected]>
<J#[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<#[email protected]>
<[email protected]>
<[email protected]>
<5#[email protected]>
| Subject: Re: datagrid scrolling/ threading problem
| Date: Thu, 11 Sep 2003 10:50:47 +0100
| Lines: 15
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| NNTP-Posting-Host: mailgate.synergy-logistics.co.uk 62.49.130.162
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:52132
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
|
| Hi Ying-Shen
|
| > It's not good to make your merge depending on the scroll event ,
you
| > see, it should depend on your data arrival. You may do merge after you
| got
| > the newDataset. Then I think you can get your expected result.
|
| I actually tried that but what happens is i get 2 vscroll bars (and 2
| hscroll bars) appearing.
| I think thats something to do with the newDataset being created on a
thread.
| (not the main thread). Is this true?
| i wait for your reply
| thanks.
|
|
|
 
Hi Ying Shen
The link you sent doesnt work.
I have never used delegates before. please send any useful links

thanks
 
Hi Hugh,
I'm sorry I didn't make it clear. Here is some articles on how to use
the invoke and how to define your own delegate,
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/
vbtskmanipulatingcontrolsfromthreads.asp

This is an example on how to use controls across the thread boundary
http://samples.gotdotnet.com/quickstart/howto/doc/WinForms/WinFormsThreadMar
shalling.aspx

here is the documentation of the method Control.Invoke
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWindowsFormsCo
ntrolClassBeginInvokeTopic.asp?frame=true

If you still have problem in implementing, please let me know.
Thanks!

Best regards,

Ying-Shen Yu [MS]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Reply-To: "hs" <[email protected]>
| From: "hs" <[email protected]>
| References: <[email protected]>
<J#[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<#[email protected]>
<[email protected]>
<[email protected]>
<5#[email protected]>
<#[email protected]>
<[email protected]>
| Subject: Re: datagrid scrolling/ threading problem
| Date: Thu, 11 Sep 2003 16:35:07 +0100
| Lines: 7
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| NNTP-Posting-Host: mailgate.synergy-logistics.co.uk 62.49.130.162
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:52157
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
|
| Hi Ying Shen
| The link you sent doesnt work.
| I have never used delegates before. please send any useful links
|
| thanks
|
|
|
 
Ying-Shen,

Thats fantastic! Using delegates has solved my problem. Thanks for all your
help. Without it, i wouldnt have solved the problem. Also, i've learned
something new.

regards
 
Back
Top