Okay this is a real headscratcher.
I have an application which calls a web service. It is a valid web service that pulls some data from a SQL server db, whacks it into an XML document and returns it to the Winforms app for processing.
This works fine in debug.
It fails when you run it normally but it does so returning specific data that is supposed to signal there are no valid records returned from the DB with a certain ID.
If you switch on a Wireshark packet capture after it has failed once in the release version it then works fine again.
If you start the packet capture before you get to the page that requests the service then it errors in the same way as it does when you are running it normally.
The packet capture of the one that produces the correct result shows the application make the request and then receive the data it's expecting.
The packet capture of the one that errors shows the application make the request and then explicitly receive the "no records returned" error.
One thing we have noted is that it takes about 0.25/0.5 seconds to work when it works but when it doesn't work it responds much faster.
EDIT: Okay, I knew I forgot something. I was convinced, initially, that it was the service itself. Or the SQL. So I tested the SQL, no issues. I debugged the service locally. No issue. I built a test harness to feed data into the service from my browser and capture the reult to a label. I fed it some data. It was fine. It's not the service. The service is okay. Except, apparently, when called through my Winforms app, which the packet capture confirms is sending the correct data up. And then it only fails under certain conditions. sigh
Does anyone have any idea why this might be?