I've managed to get some info from the debugger. Sorry for the poor
formatting:
- $exception {"Object reference not set to an instance of
an object." } System.NullReferenceException
- System.SystemException {"Object reference not set to an
instance of an object."} System.SystemException
- System.Exception {"Object reference not set to an
instance of an object." } System.Exception
System.Object {System.NullReferenceException} System.Object
_className null string
_COMPlusExceptionCode -532459699 int
_exceptionMethod <undefined value>
System.Reflection.MethodBase
_exceptionMethodString null string
_helpURL null string
_HResult -2147467261 int
_innerException { } System.Exception
_message "Object reference not set to an instance of an
object." string
_remoteStackIndex 0 int
_remoteStackTraceString null string
_source null string
- _stackTrace {System.Array} System.Object
[0] 0 sbyte
[1] 0 sbyte
[2] 0 sbyte
[3] 0 sbyte
[4] 0 sbyte
[5] 0 sbyte
[6] 0 sbyte
[7] 0 sbyte
[8] 40 sbyte
[9] -92 sbyte
[10] -4 sbyte
[11] 6 sbyte
[12] 79 sbyte
[13] -84 sbyte
[14] -19 sbyte
[15] 6 sbyte
[16] -96 sbyte
[17] -4 sbyte
[18] 54 sbyte
[19] 11 sbyte
[20] -40 sbyte
[21] -96 sbyte
[22] -3 sbyte
[23] 6 sbyte
_stackTraceString null string
_xcode -1073741819 int
_xptrs 188151788 int
HelpLink null string
HResult -2147467261 int
InnerException { } System.Exception
Message "Object reference not set to an instance of an
object." string
Source "System" string
StackTrace " at
System.Net.OSSOCK.WSAGetOverlappedResult(IntPtr socketHandle, IntPtr
overlapped, UInt32& bytesTransferred, Boolean wait, IntPtr
ignored)\r\n at
System.Net.Sockets.OverlappedAsyncResult.Completio nPortCallback(UInt32
errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)"
string
+ TargetSite {System.Reflection.RuntimeMethodInfo}
System.Reflection.MethodBase
errorCode 64 uint
numBytes 0 uint
- nativeOverlapped 1773720
System.Threading.NativeOverlapped*
- System.ValueType {System.Threading.NativeOverlapped}
System.ValueType
System.Object {System.Threading.NativeOverlapped}
System.Object
EventHandle 0 int
InternalHigh 0 int
InternalLow -1073741299 int
OffsetHigh 0 int
OffsetLow 10054 int
- ReservedClasslib
{System.Runtime.InteropServices.GCHandle}
System.Runtime.InteropServices.GCHandle
- System.ValueType
{System.Runtime.InteropServices.GCHandle} System.ValueType
System.Object <undefined value> System.Object
__InternalTarget
{System.Net.Sockets.OverlappedAsyncResult} System.Object
IsAllocated error: cannot obtain value bool
m_handle <has no runtime value> int
Target error: cannot obtain value System.Object
ReservedCOR1 1 int
- ReservedCOR2 {System.Runtime.InteropServices.GCHandle}
System.Runtime.InteropServices.GCHandle
- System.ValueType
{System.Runtime.InteropServices.GCHandle} System.ValueType
System.Object <undefined value> System.Object
__InternalTarget
{System.Threading.IOCompletionCallback} System.Object
IsAllocated error: cannot obtain value bool
m_handle <has no runtime value> int
Target error: cannot obtain value System.Object
ReservedCOR3 1904976 int
On Mon, 8 Dec 2003 09:00:55 -0500, "Nicholas Paldino [.NET/C# MVP]"
<mv*@spam.guard.caspershouse.com> wrote:
Vitling,
Can you show an example or give details on how to reproduce the error?
Without knowing that, it is very difficult to know what you are doing.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Vitling" <mrboo@ht_u.se> wrote in message
news:3f****************@news.microsoft.com... For no apparent reason, a NullReference exception is thrown in
system.dll
(System.Net.Sockets.OverlappedAsyncResult.Completi onPortCallback).
Since I only get a disassembly from Visual Studio, it is almost
impossible to figure out what causes this. I've tried adding:
AppDomain.CurrentDomain.UnhandledException += new
UnhandledExceptionEventHandler (SystemErrorHandler);
to my main method, and a handler function:
static void SystemErrorHandler(Object Sender,
UnhandledExceptionEventArgs Args)
{
Exception e = (Exception)Args.ExceptionObject;
Console.WriteLine ("Caught : " + e.Message);
}
But the handler never gets invoked. The exception just causes the
program to halt.
I think I've narrowed the cause down to some file-downloading done in
the program. I've tried both a WebClient.DownloadFile(), and a more
lowlevel WebRequest method, but they both causes this error.
Please help me find a way to, if not eliminate, at least contain the
exception.