System.Windows.Forms.Control.Invoke() throws ArgumentException aftersp1

  • Thread starter Thread starter Nicki Carstensen
  • Start date Start date
N

Nicki Carstensen

Greetings and salutations...

I'm using the ISynchronizeInvoke interface to call events on a
userinterface from a worker thread. But after i installed .net framework
1.1 sp1, one of the events (with a delegate like this:
public delegate void FigureReceivedHandler(Stream figure);
now thorws the exception below:

System.ArgumentException: "Invalid parameter used."
at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate
method, Object[] args, Boolean synchronous)
at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
at MopoClient.MopoClient.FigureScriptThreadFunc(String scriptname,
MATEngineImageFormat format)

Obviously there something wrong with the Stream object, but what? It
worked fine before I installed the sp1. The Stream is a MemoryStream
containing an enhancedmetafile image.

Thanks in advance

regards
Nicki
 
Hey Nicki,

There should not be any problems passing a MemoryStream between to threads
living in the same AppDomain.

I tried calling Form.Invoke from a worker-thread using a delegate similar to
yours and it worked fine. Can you post some code showing the call to Invoke?

Regards, Jakob.
 
Back
Top