本文介绍了mono的mdb文件和csc的pdb文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有教我关于pdb文件和StackTrace。

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

这是代码。

using System;

// http://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);
        }
    }
}

使用单声道,我运行

dmcs /debug error.cs
mono error.exe

当我删除/ debug选项时,我收到这个消息是一样的。

And I get this message that's the same when I deleted the /debug option.

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

使用Visual Studio 2010,我运行

With Visual Studio 2010, I run

csc /debug error.cs
error

按预期得到带有行号的消息。

To get this message with line number as expected.

Illegal weekday: thrown by try
   at TryCatchFinally.Main() in c:\error.cs:line 15




  • 问:为什么mono不会显示带有mdb文件的行号?我错过了什么吗?

  • 推荐答案

    你必须通过--debug到mono。我不知道为什么这样,我从来没有想过。

    You have to pass --debug to mono. I do not know why this is, I never thought about it before.

    dmcs /debug error.cs
    mono --debug error.exe
    

    这篇关于mono的mdb文件和csc的pdb文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 05:07