OK, quick rundown of the problem as it stands today.
I have a simple webservice call that is succeeding with no problems on most machines. On a few machines, at some point they just seem to fail and never recover. After running the application in debug mode in VS.NET, the error rears it's ugly head. Once this error occurs, no further webservice calls succeed.
On one machine, I'm running the windows application that calls on the webservice with no error for days on end. No problems whatsoever.
On another machine, the error occurs every single time. I've removed virus protection. I've run on a fresh reboot making sure as few applications were running as reasonably expected. The application will call the webservice and return results successfully and between 5-6 minutes later, Visual Studio will let me know about the following error via a messagebox:
An unhandled exception of type 'System.NullReferenceException' occurred in system.dll
This error does not appear to be trappable in any way.
Once I select continue on this error, the following will show up in the Output window:
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at System.Net.OSSOCK.WSAGetOverlappedResult(IntPtr socketHandle, IntPtr overlapped, UInt32& bytesTransferred, Boolean wait, IntPtr ignored)
at System.Net.Sockets.OverlappedAsyncResult.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
I thought that maybe it was because the webservice call I'm making is a Sub (void for you C# guys) and wasn't returning anything as a result (as expected). I've removed this call from the application and the error still occurs even after Functions are used.
A couple of people have suggested that I look at the packets. That sounds like a good suggestion, however, what am I supposed to be looking for? It appears that the webservice calls are completing successfully. It's working on many of the machines that the application is installed upon.
Now here's were I'm beginning to get a little angry. First of all, how can a NullReferenceException be happening in a manner that is so deep in the FCL? How is it that this kind of error can be occurring in a technology that is critical to the success of .NET (WebServices)? I'm not the only one who is experiencing this problem, but there doesn't appear to be any answer available to it either. I understand that a lot of people are probably using WebServices from ASP.NET, but I'm sure there are at least a few people using it from Windows Forms as well. This is supposed to be one of the most critical pieces of the technology puzzle for Windows Forms moving into the future, so I ask again, how can there be an Object reference not set to an instance of an object happening at such a low level? The test application I put together to narrow down this problem is as simple as it can get.
1. Create a webservice with a single method that accepts two parameters.
2. Call this webservice from a Windows Form application.
3. Wait 5-6 minutes while running in VS.NET.
4. Error occurs.
What exactly am I supposed to be looking for? I'm not doing anything special, strange, or out of the ordinary. Every example that I see using WebServices follows this basic pattern. The WebService doesn't even do anything, no database connection, nothing... it's just a shell that is handling the request. Again, as simple as it can possibly get. Sure, there's obviously something different about the two machines, but considering that it's supposed to be .NET and isolated from the operating system to a certain degree, running in a “Managed” environment... what exactly could be interfering with it? I'm not naive enough to thing that something is not interfering, but at the same time, everything I'm running on this machine pretty much comes out of the walls of Microsoft. Well, maybe except for the drivers... but if theres a flaw at that level, then how am I supposed to be expected to track that down? I thought that .NET is supposed to isolate the developer from those kinds of problems.
So, what to do now? Well, I'm going to do something that I'd really hate to do. I'm going to call Microsoft Support (using one of my MSDN help tickets) to see if they can make any headway on this. At this point, I'm sure that it's a bug at some level within the FCL, but I can't believe that there's not a Q article on this or that Microsoft isn't aware of it.
If I can't get the problem solved, I'll have to ditch WebServices alltogether and us some sort of technique that would be very similar to screen scraping. I'd hate to have to resort to that, but at least I know that would work as expected.
Note: Here are some search results that I've found that are similar to the problems and directions that I've tried: