Tuesday, August 15, 2006

WSE and Thread Safety

I love working in .NET sometimes...

For my application that I'm working on, am using Microsoft's Web Service Enhancements (WSE) for ensuring security of uploading and downloading of sensitive data. However, I also need to implement some thread safety on it, so I don't have the users starting multiple worker threads while the first is still running. SO -

I put in a lock as is commonly used. The lock itself works fine, it will only allow one worker thread at a time to try to hit the server that I am connecting to. But then I get back an uncaught exception which causes problems: System.Thread.ThreadStopException. Now this is apparently an exception that is supposed to not be implemented in a developer's code, is not documented in MSDN, and only occurs "*very* occasionally". So apparently, I have a bug, but I am not allowed to see what it is or prevent it from screwing around with the program. Hmm, this is probably something stupid that will take me several hours to find...

No comments: