Internet Explorer exception with Embedded Control

G

Guest

Hi,

I'm not sure where to post this as it's about windows forms, web forms,
socket communication and embedded objects.

I am developing a smart client which is embedded in a webform. This client
software communicates with a third party windows service over sockets.
However I have a weird exception being raised in the AppDomain that I can't
handle. When I finish the socket communication (all asyncronous) I popup a
modal winform, which when closed causes the following exception;

System.InvalidOperationException was unhandled
Message="The Undo operation encountered a context that is different from
what was applied in the corresponding Set operation.
The possible cause is that a context was Set on the thread and not
reverted(undone)."
Source="mscorlib"
StackTrace:
at System.Threading.SynchronizationContextSwitcher.Undo()
at System.Threading.ExecutionContextSwitcher.Undo()
at System.Threading.ExecutionContext.runFinallyCode(Object userData,
Boolean exceptionThrown)
at
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteBackoutCodeHelper(Object backoutCode, Object userData, Boolean exceptionThrown)
at
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Net.ContextAwareResult.Complete(IntPtr userToken)
at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result,
IntPtr userToken)
at
System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32
errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at
System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32
errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

The wierd thing is that, if I don't open the message window I don't get the
exception. The message window is just a form with a label and a button, so I
am assuming there is something lower level that is causing the above
exception?!?!

Any help would be appreciated as I have spent two days trying to figure this
one out.

Thanks,

Simon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top