VB6中的运行时错误堆栈跟踪或位置 [英] Runtime error stacktrace or location in VB6

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

问题描述

我保持一个VB6写的旧应用程序。在客户端的环境中,它引发了运行时错误,我无法在调试器下重现。有没有办法获得堆栈跟踪或错误的位置?



我的意思是,没有在这里或添加错误处理程序来记录每个过程,如此处



这似乎是一个简单的问题。
抱歉。
我只是不太了解VB6。
考虑到使用的广泛程度(或曾经被使用),令人惊讶的是很难google出来。

解决方案

尝试编译以编码,看看你是否仍然收到错误。这是VB6的调试模式和运行时间之间的一个常见区别。我习惯于编译为native并遇到错误,只发生在运行时。当我切换到pcode时,我发现错误消失了,或者更有可能是一个新的错误,反映了真正的问题出现,并且在调试模式下更容易复制。



如果尽管你仍然收到错误,但我真的建议您从程序堆栈的顶部开始,使用Maero的建议

  On Error Goto Handler 
< code>
退出<例程>
处理程序:
Err.Raise Err.Number,(function_name) - > &安培; Err.source,Err.Description

这是一个痛苦,但没有真正的方法。 / p>

I maintain an old application written in VB6. In client's environment it raises runtime errors which I can't reproduce under debugger. Is there any way to get the stacktrace or location of error?

I mean, without putting trace statements all over the code like here or adding error handlers for logging to every procedure like here.

It seems to be a simple question. Sorry. I just don't know VB6 very well. And it is surprisingly hard to google out any information, considering how widely it is (or used to be) used.

解决方案

Try compiling to pcode and see if you still get the error. This is one common difference between the debug mode of VB6 and runtime. I used to compile to native and ran into errors that only occurred in runtime. When I switched to pcode I found either the error went away or more likely a new error that reflected the real problem cropped up and was more easily reproduced in debug mode.

If despite that you still getting the error then I really recommend starting at the top of your procedure stack and working you way down using Maero's suggestion of

On Error Goto Handler
<code>
Exit <routine>
Handler:
Err.Raise Err.Number, "(function_name)->" & Err.source, Err.Description

It is a pain but there is no real way around it.

这篇关于VB6中的运行时错误堆栈跟踪或位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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