Solved

Debugging VB.NET DLL when called from another process

Posted on 2004-05-02
13
207 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
ID: 10974752
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
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"
0
 
LVL 6

Expert Comment

by:Mafalda
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
0
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.

 
LVL 8

Author Comment

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

0
 
LVL 6

Expert Comment

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

Author Comment

by:plq
ID: 11023588
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
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.
0
 
LVL 6

Expert Comment

by:Mafalda
ID: 11099700
No objection
0
 
LVL 8

Author Comment

by:plq
ID: 11118393
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
ID: 11146254
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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 (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

765 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