how to debug .net dll when ivoked from vbscript file
I created my .net class library, I have registsred the assembly and I am invoking the methods in the .net class library from VB Script file, I want to debug the code in the class library when methods are invoked from vb script file.
Could you please hel开发者_JAVA百科p in doing the above
If you have the source code for the .net DLL (and from the sounds of it you do), you can add this to the beginning of where you want to debug:
Debugger.Launch()
This will cause a dialog to be shown when that line is hit allowing you to pick an instance of Visual Studio to debug with. From there you can step through the code as normal.
I'm not sure if that's possible. You can set Visual Studio up to debug a Class library via an executable, but I don't think it allows a script and I'm not sure if there's some way to get around that.
If you don't actually need the script and would be happy to just debug it manually you can do it via The Immediate Window
as described on this page Debugging DLL Projects. There might be something else on that page that would help you find out how to do it from a script as well.
Visual studio has an attach to proccess option in the debug menu. If you use this and select the process that the vbscript is running you should be able to debug it.
Why not add a "Debug" property which gives you verbose exception handling and diagnostic output to file/event log?
It's probably the easiest option.
精彩评论