Mono mdb file vs csc pdb file

I have this post that teaches me about the pdb file and StackTrace.

This is the code.

using System; // https://stackoverflow.com/questions/4474259/c-exception-handling-with-a-string-given-to-a-constructor class WeekdayException : Exception { public WeekdayException(String wday) : base("Illegal weekday: " + wday) {} } class TryCatchFinally { public static void Main() { try { throw new WeekdayException("thrown by try"); } catch(WeekdayException weekdayException) { Console.WriteLine(weekdayException.Message); Console.WriteLine(weekdayException.StackTrace); } } } 

With mono, I run

 dmcs /debug error.cs mono error.exe 

And I get this message the same when I removed the / debug option.

 Illegal weekday: thrown by try at TryCatchFinally.Main () [0x00000] in <filename unknown>:0 

With Visual Studio 2010, I run

 csc /debug error.cs error 

To receive this message with a line number as expected.

 Illegal weekday: thrown by try at TryCatchFinally.Main() in c:\error.cs:line 15 
  • Q: Why does mono not show the line number with the mdb file? Did I miss something?
+4
source share
1 answer

You need to pass --debug to mono. I don’t know why this is so, I never thought about it.

 dmcs /debug error.cs mono --debug error.exe 
+6
source

Source: https://habr.com/ru/post/1332545/


All Articles