c# - 在 MonoMac 应用程序堆栈跟踪上打印行号

标签 c# macos cocoa mono monomac

我有一个 MonoMac 应用程序,想看看是哪一行导致了异常。我所有的堆栈跟踪都是这样的:

[ERROR] FATAL UNHANDLED EXCEPTION: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: I am going to crash now.
  atSync.MacConfiguration..ctor (System.String destinationPath, IDatabasePathGenerator pathGenerator) [0x00000] in <filename unknown>:0 
  at Sync.MacConfiguration..ctor () [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
at System.Reflection.MonoCMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) <0x001f3>
at System.Reflection.MonoCMethod.Invoke (System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) <0x00024>
at System.Reflection.ConstructorInfo.Invoke (object[]) <0x00042>
at System.Activator.CreateInstance (System.Type,bool) <0x001d3>
at System.Activator.CreateInstance (System.Type) <0x00013>
at Sync.ConfigurationSection.get_Configuration () <0x00043>
at Sync.Configuration.LoadFromXML (string) <0x000cf>
at Sync.Configuration.get_Default () <0x0005f>
at Sync.Mac.AppDelegate..ctor () <0x00037>
at (wrapper dynamic-method) object.905edfe4-e0b5-4f92-955e-4e10c991fb3a (intptr,MonoMac.ObjCRuntime.Selector) <0x00057>
at (wrapper native-to-managed) object.905edfe4-e0b5-4f92-955e-4e10c991fb3a (intptr,MonoMac.ObjCRuntime.Selector) <0x0006f>
at (wrapper managed-to-native) MonoMac.AppKit.NSApplication.NSApplicationMain (int,string[]) <0x00003>
at MonoMac.AppKit.NSApplication.Main (string[]) <0x0003f>
at Sync.Mac.MainClass.Main (string[]) <0x000e7>

我已尝试将 .mdb 文件复制到 Contents/MonoBundle 文件夹,但我仍然没有在堆栈跟踪中看到行号。

关于如何解决这个问题的任何提示?

最佳答案

在 Linux 中,要查看行号,您不仅需要 .mdb,还需要使用标志“--debug”调用 mono。

现在,在 Mac 上,我不确定这是否可行(或者是否可行,因为您使用的是 bundle ,我不确定这是否意味着您将全部编译成一个可执行文件?)。

关于c# - 在 MonoMac 应用程序堆栈跟踪上打印行号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13185389/

相关文章:

控制台中的 C# 简单 "Hello World"缺少一行代码?

c# - 注入(inject)。可选注入(inject)

javascript - 使用 nodejs 和 NPM 包括其他库/文件/插件

objective-c - 将 CALayer 子层压平为一层

objective-c - NSTextView -(无效)setMarkedTextAttributes : method how to set which text is marked?

iphone - 由于 iPhone 应用程序中的 "message sent to deallocated instance"导致崩溃不一致

c# - 将按钮放在右下角的 XAML 代码

c# - 将 wchar_t** 从 C++ 编码到 C# 作为输出参数?

c++ - OSX、VideoToolbox、压缩 session

objective-c - 如何编写 OS X Finder 插件