21. February 2013 16:11
Normally, if you have to rethrow and existing exception in .NET, you should use the throw keyword without any parameters:
// Code that can generate exceptions here
catch (Exception ex)
// Do some logging or whatever
Using throw ex; would cause the stack trace of the exception to be lost, in which case we lose some valuable information. However, this only works inside the catch block that caught the exception in the first place.
Sometimes, you need to rethrow the exception at a later point outside the catch block, but of course we want to preserve the stack trace.
30. May 2010 10:12
I have spent a considerable amount of time on development in a service-oriented architecture. On the Microsoft platform, the technology of choice is WCF (Windows Communication Foundation). Generally, it is a great technology, but it does have its nuisances. One of them is the way certain error conditions are handled when consuming web services.