Could you please check this exception?
-
hello... when i wase test my solution, i found exception. message is... ---------------- 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). ---------------- that is riaseup after this code
p_han = OpenProcess(1, false, (IntPtr)ps.Id);
TerminateProcess(p_han, 0);
CloseHandle(p_han);this code is kill process from my ui form command. why raiseup is exception ?
-
hello... when i wase test my solution, i found exception. message is... ---------------- 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). ---------------- that is riaseup after this code
p_han = OpenProcess(1, false, (IntPtr)ps.Id);
TerminateProcess(p_han, 0);
CloseHandle(p_han);this code is kill process from my ui form command. why raiseup is exception ?
There's not enough information to troubleshoot this. The message your exception is supplying has, on the surface, nothing to do with the code you posted. One problem I see is that your opening a process, then killing it while you have the process open. Try closing the process first, THEN killing it. It's entirely possible that the handle you get in the OpenProcess line is no longer valid when you try and Close it. Frankly, this reeks of copy'n'paste coding.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
hello... when i wase test my solution, i found exception. message is... ---------------- 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). ---------------- that is riaseup after this code
p_han = OpenProcess(1, false, (IntPtr)ps.Id);
TerminateProcess(p_han, 0);
CloseHandle(p_han);this code is kill process from my ui form command. why raiseup is exception ?