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

编程入门 行业动态 更新时间:2024-10-21 04:03:27
本文介绍了VB6中的运行时错误堆栈跟踪或位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我保持一个VB6写的旧应用程序。在客户端的环境中,它引发了运行时错误,我无法在调试器下重现。有没有办法获得堆栈跟踪或错误的位置?

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

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

解决方案

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

如果尽管你仍然收到错误,但我真的建议您从程序堆栈的顶部开始,使用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中的运行时错误堆栈跟踪或位置

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

发布评论

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

>www.elefans.com

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