.Net 1.1 upgrade problem : ListBox gets ExecutingEnging.Exception during remoting

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

Guest

Hi,

we have an application with a remoting interface between a clien app and a service app.

The client has a listbox:

internal class DynamicListBox : System.Windows.Forms.ListBox {

wich holds a list of entries:

private ADynamicListBoxItem[] itemArray() {

and the listbox entries are based on our own listboxitem class:

internal abstract class ADynamicListBoxItem : MarshalByRefObject, IDisposable {

The object that holds information about what to show in the entries list is complex (with internal objects and nested object references) and it is accessed on ther server from the client via remoting (all MarshalByRefObject).

The list is dynamically updated based on events from the server.

Now to the problem:

After upgrading the code to .Net 1.1 we get ExecutingEngine.Exceptions on the client (the server is unaffected).

We have observed this pattern:
- send a bundle of events from the server to the client which makes it update a list item (icon changing).
- wait 20-30 seconds - send a new event and BANG the client crashes.

An help getting closer to a solution to this problem will be greately appreciated.

The same code is running fine on .Net 1.0 where it has been in production for several months.

Thank you
Mads
 
Hello Mads,

Thanks for your post. As I understand, the problem you are facing is that
it your ListBox throws an exception when receiving an event from server.
Please correct me if there is any misunderstanding. I think more
information is needed before moving forward:

Would you please tell me the detailed information of the exception say,
error message, call stack, etc?
Is it possible to post simple projects and the destailed steps to reproduce
the problem? I will be glad to check it on my side.

In addition, I believe such question is best suited for the following
newsgroup:
microsoft.public.dotnet.framework.remoting

I look forward to hearing from you.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
The exception is 'ExecutionEngineException' not 'ExecutingEngine.Exception'- an exception which can't be catched, so we can't see the stack trace - it isn't usefull

We have now tried to make a sample - but we haven't succeeded yet
But we have seen
The event causing the problem uses a BeginInvoke-method to get the code to the listbox-controls thread, but if we just call a method in the current (remoting) thread it works

regard
Bo and Mad

PS We have also posted this on the group microsoft.public.dotnet.framework.remoting
 
Hello Bo and Mads,

Thanks for your reply. Now I'd like to share the following information with
you:

1. As you know, the controls in Windows forms are not thread-safe, so we
need to use Invoke or BegineInvoke to marshal the calls across the thread
boundaries. Since you suspected that the problem may be caused by
BegineInvoke, I suggest that you can use Invoke instead to check if the
problem still exists. The difference between Invoke and BegineInvoke is
that the first one is synchronous and the latter is asynchronous.

2. In order to better diagnose the problem, I would like you to add a
ThreadException handler to your application and get the call
stack.

Application.ThreadException Event
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemwindowsformsapplicationclassthreadexceptiontopic.asp

I am standing by for your response.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Sorry for the late answer, but we have used a lot of time on this upgrade, so when we got through we had a lot of urgent tasks waiting

Remoting gave ExecutionEngineException after upgrading from .NET 1.0 to .NET 1.1. Using .NET 1.0 the application was working fine and was stable. This describes the workaround we found to avoid the exception

Our application is a server with several clients listening on many different events. The server starts these events from different sources. Since the clients need to get the event in nearly “real timeâ€, all events are sent from its own thread. That is because we can’t wait on timeout from one client (if the client has lost its connection) before the event is sent to the next client

The error is dependant of the timing of the code, e.g. it occurred more often when we were using TcpChannel instead of HttpChannel (which is slower)

What we have done to get it working

It turned out that we got the ExecutionEngineException when we were using BeginInvoke on an ownerdrawed Listbox. We were using BeginInvoke to get all graphic update running on the same thread (the client thread) – because not all the Windows controls are thread safe.
It turned out that executing everything in the remoting thread rather than in the client thread made things work better. However, this gave us a synchronization problem since the windows controls are not thread safe. We solved the synchronization problems by having a single object (per client) on the client side which is doing all the listening from the server, and on the server side we have introduced a lock on this object. So now the client will only receive one event from the server at the time

The conclusion is that our server needs to do a lot of administration to prevent two events are sent to the same client at the same time, and that the client must do the entire needed updating etc. in the remoting thread

We have shortly tried to make a sample of this, but we didn’t succeed on that in the couple of hours we used.
 
Back
Top