Rethrowing exceptions and preserving the full call stack trace

Posted by: Fabrice's weblog, on 02 Jan 2008 | View original

Did you know that depending on the way you rethrow exceptions you may lose important information? There are already several blog posts that explain and demonstrate the difference between throw and throw ex. I'm realizing only now that none of the two solutions yields the complete call stack trace information!Let's see what the problem is and I'll show you the real solution.I'll use the following method to generate an exception:private static void BadWork(){  int i = 0;  int j = 12 / i;...

Advertisement
The leading UI suite for ASP.NET - Telerik radControls
Outstanding performance. Full ASP.NET AJAX support. Nearly codeless development.

Similar Posts

  • Just spent way too much time fixing VB code coloring on MSDN2 more
  • Asynchronous Programming in Indigo more
  • Asynchronous Programming in Indigo more

News Categories

.NET | ADO.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Community Server | dasBlog | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD