Windows Service NullReference Exception

M

mdhaman

hi,

I have a windows service written in VB.Net and framework 2.0. It is a
multithread service and it is using threadpool to manage threads.

Recently I have started getting NullReferenceException and after that
windows service crashes.

System.Transactions Critical: 0 : <TraceRecord
xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord"
Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled
exception</Description><AppDomain>PublishingServiceTestApp.vshost.exe</AppDomain><Exception><ExceptionType>System.NullReferenceException,
mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Object reference not
set to an instance of an object.</Message><StackTrace> at
System.Threading.Overlapped.Free(NativeOverlapped* nativeOverlappedPtr)
at System.Net.Sockets.OverlappedCache.InternalFree()
at
System.Net.Sockets.OverlappedCache.InterlockedFree(OverlappedCache&amp;amp;
overlappedCache)
at
System.Net.Sockets.BaseOverlappedAsyncResult.ForceReleaseUnmanagedStructures()
at System.Net.Sockets.BaseOverlappedAsyncResult.Cleanup()
at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
at System.Net.ContextAwareResult.CompleteCallback(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
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)</StackTrace><ExceptionString>System.NullReferenceException: Object
reference not set to an instance of an object.
at System.Threading.Overlapped.Free(NativeOverlapped*
nativeOverlappedPtr)
at System.Net.Sockets.OverlappedCache.InternalFree()
at
System.Net.Sockets.OverlappedCache.InterlockedFree(OverlappedCache&amp;amp;
overlappedCache)
at
System.Net.Sockets.BaseOverlappedAsyncResult.ForceReleaseUnmanagedStructures()
at System.Net.Sockets.BaseOverlappedAsyncResult.Cleanup()
at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
at System.Net.ContextAwareResult.CompleteCallback(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
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)</ExceptionString></Exception></TraceRecord>

Can anyone help me to identify the problem?
 
G

Guest

It's impossible to tell without showing the key parts of your sourcecode. Try
to run the service under the debugger by attaching the debugger to the
running server process and see where the exception occurs.

-MagicBox
 

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