堆栈跟踪不正确的行号 [英] Stack trace with incorrect line number

查看:448
本文介绍了堆栈跟踪不正确的行号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么会堆栈跟踪显示0行,,但只在堆栈跟踪一帧

Why would a stack trace show "line 0", but only for one frame in the stack trace?

如:

...
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
at My.LibraryA.Some.Method():line 16
at My.LibraryB.Some.OtherMethod():line 0
at My.LibraryB.Some.Method():line 22
at My.LibraryA.Some.Method():line 10

背景:

我有失败有异常,并记录堆栈跟踪其日志文件的应用程序。当applciation建成,所有的组件都以饱满的调试信息编译(项目属性 - >生成 - >高级 - >调试信息 - >全部),因此生成PDB文件。为了帮我诊断,其中的误差是从哪里来的,我放弃了PDB文件到应用程序的目录,并再现例外。每个堆栈帧的所有行号看起来是正确的,除了其中一个显示0行作为其来源。

I have an application that is failing with an exception, and is logging a stack trace to its log file. When the applciation was built, all assemblies were compiled with full debug info (Project Properties -> Build -> Advanced -> Debug Info -> Full), and so PDB files were generated. To help me diagnose where the error is coming from, I dropped the PDB files into the application's bin directory, and reproduced the exception. All line numbers for each stack frame look correct, with the exception of one which displays "line 0" as its source.

推荐答案

这确实是下来他们的方法的内联埃里克建议。

This was indeed down the the inlining of them method as Eric suggested.

我设法在本地重现原来的错误,但只有在一个发布版本编译时。由于我有PDBS,我可以逐步完成code和发现问题。

I managed to reproduce the original error locally, but only when compiling in a release build. As I had the PDBs, I could step through the code and find the problem.

这篇关于堆栈跟踪不正确的行号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆