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
Free Agile Project Management Tool from Telerik
TeamPulse Community Edition helps your team effectively capture requirements, manage project plans, assign and track work, and most importantly, be continually connected with each other.
Category: .NET | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 1185 | Hits: 56

Similar Posts

  • CTP before the official release of Telerik's charts, gauges and scheduler for WPF more
  • Custom ASP.NET Page Tracing more
  • Introducing CallerID Part 3 more
  • AJAX With ASP.NET MVC and ComponentArt CallBack more
  • Foundations of Programming - pt 7 - Back to Basics: Memory more
  • JSONP for cross-site Callbacks more
  • Replacing Recursion With a Stack more
  • Add Profile Items in CreateUserWizard and Recursive FindControl more
  • Just spent way too much time fixing VB code coloring on MSDN2 more
  • Asynchronous Programming in Indigo 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