Is it possible to get the stack trace information in Visual Basic 6.0. I mean I want to find out the function name and exact line that causes the error similar to .NET stack trace. I have created an ActiveX DLL which works fine in my test environment but it throws an error in production environment(error : 91-Object variable or With block variable not set). Any help on this much appreciated.
相关问题
- Convert VB's Val to Java?
- Invalid Picture In Visual basic 6
- Compile is really slow for a solution with many pr
- vb6 Open File For Append issue Path Not Found
- DSN-less ODBC connect string for legacy Sybase Ada
相关文章
- Reading (with Filesystem.FileGet) VB6 record file
- Trim all types of whitespace, including tabs
- How to destroy an object
- How to prepend a header in a text file
- VB6 — using POST & GET from URL and displaying in
- Using a VB6.dll in .Net
- Dynamic two or more levels sub-menu generation in
- Convert VB6 app to WPF?
You may not be able to get at that in VB6. previous question.
Get as much information from the Err object.
The only option is to do it manually, with VB6's error handling.
Here is an example:
http://www.vbaccelerator.com/home/vb/code/Techniques/RunTime_Debug_Tracing/article.asp
My preferred method for doing this is HuntERR ; it's under a permissive license so can be used with impunity in any project.
http://www.devx.com/vb2themax/Tip/19792
This is an excellent static library for VB6 that permits full stack traces with as much information as you care to include.
It benefits tremendously from having some automation in your IDE to insert the error handlers and line numbers.
The archive as linked has a number of extras that I am not familiar with, including what seems to be a VB6 IDE addin - I shall be adding this to my collection of VB6 kit.
This library can literally take you from going "HUH?" to having a stack trace with full line numbering, it gives VB6 an professional level of error handling when used correctly.
This is a good way to do it - an answer on the existing duplicate question. Use MZTools to insert the error handlers automatically
Alternatively, you can debug your built DLL in the production environment using WinDBG, a free standalone debugger from Microsoft. Compile your DLL into native code with symbols (create PDB files).
Here's a 2006 blog post by a Microsoft guy about using Windbg with VB6, and 2004 blog post by another Microsoft guy with a brief introduction to Windbg.
VB6 doesn't seem to have a decent way to do that natively.
It's a bit cumbersome, but you could put together a custom solution that adds lines to a text file whenever you want it to. Put together a method somewhere that looks like this:
and then manually call it from your own functions
It doesn't solve the problem, but it might help you narrow it down.
With regards to your specific error, I would go through and check situations where you're assigning an object to a variable - I find that it's easy to forget the
Set
keyword and get the exact same error when I least expect it.