fork download
  1. using System;
  2. using static System.Console;
  3.  
  4. public class Program {
  5. public static void Main(string[] args) {
  6. try {
  7. ThrowException1(); // line 19
  8. } catch (Exception x) {
  9. WriteLine("Exception 1:");
  10. WriteLine(x.StackTrace);
  11. }
  12. try {
  13. ThrowException2(); // line 25
  14. } catch (Exception x) {
  15. WriteLine("Exception 2:");
  16. WriteLine(x.StackTrace);
  17. }
  18. }
  19.  
  20. private static void ThrowException1() {
  21. try {
  22. DivByZero(); // line 34
  23. } catch {
  24. throw; // line 36
  25. }
  26. }
  27.  
  28. private static void ThrowException2() {
  29. try {
  30. DivByZero(); // line 41
  31. } catch (Exception ex) {
  32. throw ex; // line 43
  33. }
  34. }
  35.  
  36. private static void DivByZero() {
  37. int x = 0;
  38. int y = 1 / x; // line 49
  39. }
  40. }
  41.  
  42. //https://pt.stackoverflow.com/q/34181/101
Success #stdin #stdout 0.02s 16856KB
stdin
Standard input is empty
stdout
Exception 1:
  at Program.ThrowException1 () [0x0000b] in <9557e73624ba45559b8f62de62f4f57b>:0 
  at Program.Main (System.String[] args) [0x00000] in <9557e73624ba45559b8f62de62f4f57b>:0 
Exception 2:
  at Program.ThrowException2 () [0x0000b] in <9557e73624ba45559b8f62de62f4f57b>:0 
  at Program.Main (System.String[] args) [0x00025] in <9557e73624ba45559b8f62de62f4f57b>:0