'Transition into COM context for this RuntimeCallableWrapper failed' error in parallel programming

1

I have some methods which are calling SPs from SQL Server. In UI I am calling methods using parallel Programming like below:

Parallel.Invoke(
()=>{value1=GetData1(filterCriteria); },
()=>{value2=GetData2(filterCriteria); },
()=>{value3=GetData3(filterCriteria); },
()=>{GetData4(filterCriteria); }
);  

I am facing the below error.

"Transition into COM context 0x4f0100 for this RuntimeCallableWrapper failed with the following error: System call failed. (Exception from HRESULT: 0x80010100 (RPC_E_SYS_CALL_FAILED)).
This is typically because the COM context 0x4f0100 where this RuntimeCallableWrapper was created has been disconnected or it is busy doing something else. Releasing the interfaces from the current COM context (COM context 0x4f01b8). This may cause corruption or data loss. To avoid this problem, please ensure that all COM contexts/apartments/threads stay alive and are available for context transition, until the application is completely done with the RuntimeCallableWrappers that represents COM components that live inside them."

What is the possible cause and how to avoid this error? Please suggest.

c#
c#-4.0
asynchronous
parallel-processing
asked on Stack Overflow Apr 21, 2016 by Rachit • edited Apr 21, 2016 by user2216

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0