Home All Groups Group Topic Archive Search About

GridView Exception: reentrant call to the SetCurrentCellAddressCore function

Author
28 Jun 2005 3:23 PM
Martin B

Hallo to everyone!

Problem:
--------
GridView Exception: reentrant call to the SetCurrentCellAddressCore function

System:
-------
WinXP Professional, english, .NET Framework 2.0 Beta Language C#

Simplified Architecture of my Porgram:

2 Forms:
--------
- MainForm
- DetailForm

2 Threads:
----------
- Main Thread which runs the MainForm //Application.Run(MainForm)
- Telegram Thread //receiving Socket Data for visualization

Scenario:
---------
Telegram Thread receives frequently (2s) socket data which forces the
Main Thread via Callback 'Visualization' to refresh the Data in
the GridView. Within the Callback function 'Visualization' the
Telegram Thread could return immediately, doing his job, by calling
this.Invoke(new VisualDelegate(MainFormVisual)).
'MainFormVisual' wires up the GridView.DataSource with a DataTable,
which is stored offline in memory, as shown in the following lines

1.  gvMyGridView.DataSource = null;
2.  gvMyGridView.DataSource = BuildActData(); //returning a DataTable

After a undifined and non reproduceable timespan (approx. 20 min)
repating this scenario, the following Exception will be thrown at line 1:
EXCEPTION: Operation is not valid because it results in a reentrant call to
the SetCurrentCellAddressCore function.

Thank you for every advice, bugfix or workaround

Martin
Author
28 Jun 2005 3:37 PM
cody
when calling this.Invoke() are your sure that "this" and "gvMyGridView" runs
in the same thread? if not use gvMyGridView.Invoke().


Show quoteHide quote
"Martin B" <martin.brug***@gamed.com> schrieb im Newsbeitrag
news:42c15d69$0$14558$79720d31@newsreader.inode.at...
> Hallo to everyone!
>
> Problem:
> --------
> GridView Exception: reentrant call to the SetCurrentCellAddressCore
function
>
> System:
> -------
> WinXP Professional, english, .NET Framework 2.0 Beta Language C#
>
> Simplified Architecture of my Porgram:
>
> 2 Forms:
> --------
> - MainForm
> - DetailForm
>
> 2 Threads:
> ----------
> - Main Thread which runs the MainForm //Application.Run(MainForm)
> - Telegram Thread //receiving Socket Data for visualization
>
> Scenario:
> ---------
> Telegram Thread receives frequently (2s) socket data which forces the
> Main Thread via Callback 'Visualization' to refresh the Data in
> the GridView. Within the Callback function 'Visualization' the
> Telegram Thread could return immediately, doing his job, by calling
> this.Invoke(new VisualDelegate(MainFormVisual)).
> 'MainFormVisual' wires up the GridView.DataSource with a DataTable,
> which is stored offline in memory, as shown in the following lines
>
> 1.  gvMyGridView.DataSource = null;
> 2.  gvMyGridView.DataSource = BuildActData(); //returning a DataTable
>
> After a undifined and non reproduceable timespan (approx. 20 min)
> repating this scenario, the following Exception will be thrown at line 1:
> EXCEPTION: Operation is not valid because it results in a reentrant call
to
> the SetCurrentCellAddressCore function.
>
> Thank you for every advice, bugfix or workaround
>
> Martin
>
>
Are all your drivers up to date? click for free checkup

Author
29 Jun 2005 9:10 AM
Martin B
Hallo Cody!

Thanx for your quick reply and I'm sorry for the inconvenience in my
description.
It would be better to recommend that with this.Invoke I mean
MainForm.Invoke, and MainForm is
the owner which created gvMyGridView.

I also read plenty of MSDN-documents on topics about Control.Invoke and
Delegate.Invoke, where I found
out that Control.Invoke processes the given Delegate on the underlying
Thread which created the Control (in my case
it is the Main-Thread. I understood it that way, that with a Control.Invoke
an implicit SendMessage is called to the win32 Message-Queue of my MainForm.
(To be pecisely Now I use a Control.BeginInvoke -implicitely PostMessage-
for async calls, instead).
On the other hand Delegate.Invoke/BeginInvoke executes the Delegate on the
next availeable thread on the Thread-Pool.
So for me it sounds that my call will be queued into the Message-Queue of
MainForm by my Socket-Thread, and dequeued by the Main-Thread to be
processed sequential (not like Delegate.BeginInvoke where parallel
processing is possible).

Maybe now you could understand why I'm really wondering about an exception
about REENTRANCY - I can not see a circumstance on my side where two threads
try to call any code section concurrently.

Maybe there is somthing wrong with my way of DataBinding, but in Beta 1 it
worked fine!

hope for any suggestions!

bye

martin


Show quoteHide quote
"cody" <deutron***@gmx.de> wrote in message
news:%23D8brg$eFHA.228@TK2MSFTNGP12.phx.gbl...
> when calling this.Invoke() are your sure that "this" and "gvMyGridView"
> runs
> in the same thread? if not use gvMyGridView.Invoke().
>
>
> "Martin B" <martin.brug***@gamed.com> schrieb im Newsbeitrag
> news:42c15d69$0$14558$79720d31@newsreader.inode.at...
>> Hallo to everyone!
>>
>> Problem:
>> --------
>> GridView Exception: reentrant call to the SetCurrentCellAddressCore
> function
>>
>> System:
>> -------
>> WinXP Professional, english, .NET Framework 2.0 Beta Language C#
>>
>> Simplified Architecture of my Porgram:
>>
>> 2 Forms:
>> --------
>> - MainForm
>> - DetailForm
>>
>> 2 Threads:
>> ----------
>> - Main Thread which runs the MainForm //Application.Run(MainForm)
>> - Telegram Thread //receiving Socket Data for visualization
>>
>> Scenario:
>> ---------
>> Telegram Thread receives frequently (2s) socket data which forces the
>> Main Thread via Callback 'Visualization' to refresh the Data in
>> the GridView. Within the Callback function 'Visualization' the
>> Telegram Thread could return immediately, doing his job, by calling
>> this.Invoke(new VisualDelegate(MainFormVisual)).
>> 'MainFormVisual' wires up the GridView.DataSource with a DataTable,
>> which is stored offline in memory, as shown in the following lines
>>
>> 1.  gvMyGridView.DataSource = null;
>> 2.  gvMyGridView.DataSource = BuildActData(); //returning a DataTable
>>
>> After a undifined and non reproduceable timespan (approx. 20 min)
>> repating this scenario, the following Exception will be thrown at line 1:
>> EXCEPTION: Operation is not valid because it results in a reentrant call
> to
>> the SetCurrentCellAddressCore function.
>>
>> Thank you for every advice, bugfix or workaround
>>
>> Martin
>>
>>
>
>

Bookmark and Share