VB6 中的运行时错误堆栈跟踪或位置

编程入门 行业动态 更新时间:2024-10-21 06:18:21
本文介绍了VB6 中的运行时错误堆栈跟踪或位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我维护一个用 VB6 编写的旧应用程序.在客户端的环境中,它会引发我无法在调试器下重现的运行时错误.有什么方法可以获取堆栈跟踪或错误位置吗?

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.

这似乎是一个简单的问题.对不起.我只是不太了解VB6.考虑到它被(或曾经)使用的广泛程度,谷歌搜索出任何信息是非常困难的.

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.

推荐答案

尝试编译成 pcode 看看是否仍然报错.这是 VB6 的调试模式和运行时之间的一个共同区别.我曾经编译为本机并遇到仅在运行时发生的错误.当我切换到 pcode 时,我发现错误消失了,或者更可能是一个反映实际问题的新错误出现了,并且在调试模式下更容易重现.

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.

如果您仍然遇到错误,那么我真的建议您从程序堆栈的顶部开始,并使用 Maero 的建议逐步向下进行

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 中的运行时错误堆栈跟踪或位置

本文发布于:2023-11-11 22:54:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1579775.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:堆栈   错误   位置

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!