Rethrowing exceptions and preserving the full call stack trace

Posted by: Fabrice's weblog, on 02 Jan 2008 | View original | Bookmarked: 0 time(s)

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
Category: .NET | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 1115 | Hits: 56

Similar Posts

  • CTP before the official release of Telerik's charts, gauges and scheduler for WPF more
  • Introducing CallerID Part 3 more
  • Custom ASP.NET Page Tracing more
  • Foundations of Programming - pt 7 - Back to Basics: Memory more
  • Custom ASP.NET Page Tracing more
  • Foundations of Programming - pt 7 - Back to Basics: Memory more
  • Foundations of Programming - pt 7 - Back to Basics: Memory more
  • Foundations of Programming - pt 7 - Back to Basics: Memory more
  • Custom ASP.NET Page Tracing more
  • Foundations of Programming - pt 7 - Back to Basics: Memory more

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | 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