本文介绍了无法从Mono .dll获取stacktrace,源代码行信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Windows Server 2012上运行某些.NET .dll. .NET程序集是使用Xamarin 4.0OS X上的C#代码编译的. (是的,我知道设置很奇怪-但我是游戏开发人员)通常,它们运行良好,但是在检查Exception信息时,效果不是很好.我正在尝试将信息从Exception对象中拉出,但是全部为空.我还尝试将.mdb文件与.dll一起复制,并确保我在Debug中进行构建,并带有调试符号.例如此代码

I am running some .NET .dlls on Windows Server 2012. The .NET assemblies were compiled from C# code on OS X with Xamarin 4.0. (yeah I know weird setup- but I am a game developer)In general they run perfectly, but when it comes to inspecting Exception information, it's not so good. I am trying to pull info out of an Exception object, but it's all empty. I also tried copying the .mdb files along with the .dlls, and made sure I was building in Debug, and with debug symbols.For example this code

log.Error (ex.ToString ());
var st = new StackTrace(ex, true);
var frame = st.GetFrame(0);
var line = frame.GetFileLineNumber();
log.ErrorFormat ("st: {0}, frame: {1}, line: {2}", st.ToString (), frame.ToString (), line);

基本上这样生成输出,只是方法名称

Generates output like this, just the method name, basically

System.NullReferenceException: Object reference not set to an instance of an object.
at Mindlube.CD3.RandomMatchMaker.ProcessMatchQueue() [ThreadFiber-1] ERROR Mindlube.CD3.App [(null)] - st:
at Mindlube.CD3.RandomMatchMaker.ProcessMatchQueue(), frame: ProcessMatchQueue
at offset 927 in file:line:column <filename unknown>:0:0, line: 0

关于获取更详细的Exception信息的任何建议?目前尚不能在Windows上使用Visual Studio,因为我没有时间重新构建整个开发环境.所以不要说使用VStudio":)

Any suggestions for getting more detailed Exception information? Using Visual Studio on Windows is not currently an option because I don't have time to re-tool my entire dev environment. So don't say 'use VStudio' :)

推荐答案

这是因为.NET无法理解mdb文件.

This is because .NET does not understand mdb files.

不幸的是,没有工具可以将mdb文件转换为pdb文件,唯一的选择是在Windows计算机上使用Mono编写自己的文件或执行应用.

Unfortunately there is no tool to convert mdb files to pdb files, your only options would be to either write your own or execute your app using Mono on your Windows machine.

这篇关于无法从Mono .dll获取stacktrace,源代码行信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 15:56