Results 1 to 2 of 2

Thread: Undo Operation Error

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2003
    Location
    Birmingham, AL
    Posts
    188

    Undo Operation Error

    Code:
    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)
      InnerException:

    I am completely lost on this one. I don't really understand the error I suppose.

    In my network application I have 2 forms the main form and a dialog form which lists information in a listview. The dialog opens and loads the data into the listview correctly and it works properly until I close it. that is when I get the above error.

    A little about my app:
    The dialog is a static object in the main. During the parsing of the data when I recieve a particular end of list command I set a collection I have made to the value for the collection of the same type in the dialog then use the ShowDialog() to open it. In the Load event for the dialog I loop through the collection adding formation from it to the listview as should. Nothing else is done up to this point in the dialog. The error is only thrown when I close this particular dialog and it is giving me no other indication as to what might be causing it.

    I appreciate any help, thanks.
    Last edited by Tewl; Jan 11th, 2009 at 10:10 AM.

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Jun 2003
    Location
    Birmingham, AL
    Posts
    188

    Re: [3.0/LINQ] Undo operation error

    Ok new development. I managed to get rid of this exception by creating a Callback in the main form and using it to open the dialog.

    HOWEVER, I just realized that ShowDialog prevents data being processed until I close the dialog.

    How can I still get the effects of the ShowDialog, preventing user from accessing the main for while the dialog is open and such, using the Show()
    Last edited by Tewl; Jan 11th, 2009 at 02:45 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width