堆栈跟踪(发布)中的行号错误 [英] Wrong line numbers in stack trace (release)

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

问题描述

有时我们会从客户那里收到错误的行号的堆栈跟踪.它的发生并不常见,但有时却使我们感到困惑.

Sometimes we receive stack traces from our customer with wrong line numbers. It happens not so often, but sometimes it puzzles us.

客户的发布程序集具有优化功能,并带有仅pdb"调试信息.

Customers have release assemblies with optimizations and with "pdb only" debug information.

是的,我们将行号与客户使用的完全相同的代码版本进行比较.

And yes, we compare line numbers with exactly the same version of code the customer has.

是的,客户拥有正确的pdb文件.

And yes, customer has right pdb files.

不,行号的这种差异无法用内联方法(编译器优化)来解释.

And no, this difference in line numbers can't be explained with the method inlining (compiler optimization).

不,我们不使用任何AOP工具,例如PostSharp.

And no, we don't use any AOP tools, like PostSharp.

有什么想法为什么会发生?

Any ideas why does it happen?

推荐答案

不是.net专家,但至少在其他语言中,选择了较高的编译器优化时,编译器可能会对代码进行大量重新排序.这可能并且经常确实使将错误源固定到特定行变得非常困难.如果编译器能够在基本块上进行优化,那么这种效果将非常显着,将明显的行位置放在源文件的完全不同的部分.

Not a .net expert, but at least in other languages, when high compiler optimizations are chosen, the compiler may make significant reordering of code. This can and often does make it very difficult to pin the source of an error down to a particular line. If the compiler is able to make optimisations across basic blocks, then this effect can be very significant, putting the apparent line location in a totally different part of the source file.

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

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