Debugging VB.NET DLL when called from another process

Posted on 2004-05-02
Last Modified: 2010-04-24
Hi There

Using 2003

I need to be able to debug a DLL as follows:

- When I set a breakpoint (f9) it actually stops on the line
- When the program does an err.raise it actually stops on the line

At the moment it runs through regardless. I can put stop statements in and that will break it into the debugger, but the Err.raise always just executes the error handler, it doesn't break. And f9 breakpoint lines are just ignored.

I've gone into Exceptions and changed "When the Exception is Handled" to "Break into the Debugger"

The DLL is being called from ASP3 (not ASP.NET) (that is, its a COM enabled DLL)
Question by:plq
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
LVL 21

Accepted Solution

tovvenki earned 200 total points
ID: 10974752
have alook at this msdn location
It has more information that might helpyou to solve your problem


Author Comment

ID: 11020431
thanks for the link  (:-))

I'm still having problems with this. I've tried all MS's suggestions from the above link

I can fire the debugger by putting a stop, for example, in the Logon code, once its in the debugger thats great, it will pick up any future exceptions. But from a productivity point of view I need to have the debugger fire up on exceptions without having to put a Stop statement in.

The MS site explains the problem clearly, that the debugger must actually attach to the process. The problem is, you don't know which dllhost.dll is going to fire up the dll, so you don't know which one to attach to.

The MS article says "Start debugging the server as a normal application", but how can you start a DLL ? When you try to start it, you get the error : "A project with an Output Type of Class Library cannot be started directly"

Expert Comment

ID: 11023284
Your application might be running threads preventing you from following it all the way.
I suggest using the old printing tecnique to track the problematic section.
Also you could try to add an error handler and trace back the origin of the error
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now


Author Comment

ID: 11023512
Hi Mafalda,

Thanks for this. I don't understand what you mean. The problem is that the debugger is not automatically fired when the original thread raises an exception.

My program is not launching threads explicitly. What do you mean by "old printing technque" ? I can easily find the line of code that is causing a particular bug, The problem is, I spend a lot of time debugging and I need to break on an exception within my DLL without having to explicitly attach to a process, I want the debugger to fire up immediately when an exception is raised.


Expert Comment

ID: 11023534
I missed the point.
You are talknig about a VS.NET (VB.NET) setup issue ... not a bug tracking issue ...
Is the DLL part of your project/solution ?

Author Comment

ID: 11023588
the DLL is written in, has a COM wrapper and is called from old ASP pages (not You can't control which dllhost.exe process actually fires the dll.

[lets not get into an conversion discussion, this project has 280 asp pages and the DLL has 100K+ lines of vb]

The only problem I am concerned with here is not being able to break automatically when an exception is raised. Effectively, its a developer productivity issue. In VB6 you can run the dll without compiling from the IDE, you can set "break on all errors", and when an error occurs, you get the debugger right on the  line of code raising the error.

In .net there is no such luxury, you have to run iisreset which takes 20 seconds and you have to recompile on each code change, and I can't even break on an exception without doing another iisreset, insert a stop statement somewhere, and start the whole debugging process again. In practice this take programming with .NET  to a productivity level of about one tenth that of the old vb6. We might as well convert to C++, forget .net and enjoy the benefits of platform independence and performance enjoyed by c++ based apps

OK, this is getting emotional. All I want is the ability to break on an exception without putting in a stop statement and not knowing which process invokes the com component....

Author Comment

ID: 11066256
I've still not found a solution to this.

I need to know how to make the .net debugger automatically attach to a process and break when the process raises an error.

Expert Comment

ID: 11099700
No objection

Author Comment

ID: 11118393
Actually the link from tovvenki is useful to people researching, so maybe award 100 or 200 points grade A and refund the rest ?

Author Comment

ID: 11146254
Its the first comment

Comment from tovvenki
Date: 05/03/2004 06:06AM BST

200 pts grade A please !

thanks a lot

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String ( Literal, only instead of starting and ending with w…
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question