V
Vai2000
Hi All, I am running into an exception with my Multithreaded App. (This app
is derived from IServicedComponent). I am calling a method with ThreadPool
ThreadPool.QueueUserWorkItem(new WaitCallback(Foo), stateInfo);
void DoSomething()
{
ManualResetEvent[] manualEvents = new ManualResetEvent[5];
manualEvents = new ManualResetEvent(false);
ThreadPool.QueueUserWorkItem(new WaitCallback(Foo), stateInfo);
if(WaitHandle.WaitAll(manualEvents)) // THROWING EXCEPTION SAYING OBJECT
REF....SEE BELOW
Console.Write("Done");
}
void Foo(object key)
{
// set the event
}
Failed in Processing: Stack Trace- at
System.Threading.WaitHandle.WaitMultiple(WaitHandle[] waitHandles, Int32
millisecondsTimeout, Boolean exitContext, Boolean WaitAll)
at System.Threading.WaitHandle.WaitAll(WaitHandle[] waitHandles, Int32
millisecondsTimeout, Boolean exitContext)
at System.Threading.WaitHandle.WaitAll(WaitHandle[] waitHandles, TimeSpan
timeout, Boolean exitContext)
Message-Object reference not set to an instance of an object.
Inner Exception-
Source-mscorlib
Base Exception Message-Object reference not set to an instance of an object.
Base Stack Trace- at System.Threading.WaitHandle.WaitMultiple(WaitHandle[]
waitHandles, Int32 millisecondsTimeout, Boolean exitContext, Boolean
WaitAll)
at System.Threading.WaitHandle.WaitAll(WaitHandle[] waitHandles, Int32
millisecondsTimeout, Boolean exitContext)
at System.Threading.WaitHandle.WaitAll(WaitHandle[] waitHandles, TimeSpan
timeout, Boolean exitContext)
Base Source-mscorlib
is derived from IServicedComponent). I am calling a method with ThreadPool
ThreadPool.QueueUserWorkItem(new WaitCallback(Foo), stateInfo);
void DoSomething()
{
ManualResetEvent[] manualEvents = new ManualResetEvent[5];
manualEvents = new ManualResetEvent(false);
ThreadPool.QueueUserWorkItem(new WaitCallback(Foo), stateInfo);
if(WaitHandle.WaitAll(manualEvents)) // THROWING EXCEPTION SAYING OBJECT
REF....SEE BELOW
Console.Write("Done");
}
void Foo(object key)
{
// set the event
}
Failed in Processing: Stack Trace- at
System.Threading.WaitHandle.WaitMultiple(WaitHandle[] waitHandles, Int32
millisecondsTimeout, Boolean exitContext, Boolean WaitAll)
at System.Threading.WaitHandle.WaitAll(WaitHandle[] waitHandles, Int32
millisecondsTimeout, Boolean exitContext)
at System.Threading.WaitHandle.WaitAll(WaitHandle[] waitHandles, TimeSpan
timeout, Boolean exitContext)
Message-Object reference not set to an instance of an object.
Inner Exception-
Source-mscorlib
Base Exception Message-Object reference not set to an instance of an object.
Base Stack Trace- at System.Threading.WaitHandle.WaitMultiple(WaitHandle[]
waitHandles, Int32 millisecondsTimeout, Boolean exitContext, Boolean
WaitAll)
at System.Threading.WaitHandle.WaitAll(WaitHandle[] waitHandles, Int32
millisecondsTimeout, Boolean exitContext)
at System.Threading.WaitHandle.WaitAll(WaitHandle[] waitHandles, TimeSpan
timeout, Boolean exitContext)
Base Source-mscorlib