Solved

Debugging VB.NET DLL when called from another process

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

Using Vb.net 2003

I need to be able to debug a vb.net 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)
0
Comment
Question by:plq
  • 6
  • 3
13 Comments
 
LVL 21

Accepted Solution

by:
tovvenki earned 200 total points
Comment Utility
Hi,
have alook at this msdn location
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsdebug/html/vc_Debugging_Your_Application_home_page.asp.
It has more information that might helpyou to solve your problem

Regards,
Venki
0
 
LVL 8

Author Comment

by:plq
Comment Utility
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"
0
 
LVL 6

Expert Comment

by:Mafalda
Comment Utility
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
0
 
LVL 8

Author Comment

by:plq
Comment Utility
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.

0
 
LVL 6

Expert Comment

by:Mafalda
Comment Utility
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 ?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 8

Author Comment

by:plq
Comment Utility
the DLL is written in vb.net, has a COM wrapper and is called from old ASP pages (not asp.net). You can't control which dllhost.exe process actually fires the dll.

[lets not get into an asp.net 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....
0
 
LVL 8

Author Comment

by:plq
Comment Utility
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.
0
 
LVL 6

Expert Comment

by:Mafalda
Comment Utility
No objection
0
 
LVL 8

Author Comment

by:plq
Comment Utility
modulo,
Actually the link from tovvenki is useful to people researching, so maybe award 100 or 200 points grade A and refund the rest ?
0
 
LVL 8

Author Comment

by:plq
Comment Utility
Its the first comment

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

200 pts grade A please !

thanks a lot
Paul
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

728 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now