Solved

Fully exploring exceptions using the Debug Windows

Posted on 2004-04-14
7
215 Views
Last Modified: 2010-04-15
Is it possible to drill down far enough to figure out what an exception message means?

I am guessing the CORE .NET source code is not available to me so I can figure out WHY I am getting an error message and how to work-around the problem?

Sometimes the exception messages I get only tell me the problem....they don't really point to a solution at all or give me any indication of what I could do differently.  So I sit there just feeling lost and very frustrated.

I know that if I set a breakpoint in the Catch block and then start drilling down through the Locals Window variables...I can obtain SOME clues as to what is going on.

I am just wondering if there is something that can help me with debugging?  I am faithfully using Exception Handling....and this actually DOES help me very much....but sometimes it does not seem to help me.

LOL....am I just too stupid to be a programmer?  When I spend hours on a single line of code I start to wonder.  I'm kidding....but the frustration is real.

If there is some big secret to debugging that you gurus know about....please share it with me.  

If spending hours debugging just one or two lines of code is NORMAL in industry....please tell me this also.....so I can align my expectations a little better about how fast I should be putting out code.

Even if I had a few techniques to help shorten the amount of time I spend on a problem that would also be helpful.
0
Comment
Question by:knowlton
  • 4
  • 2
7 Comments
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 10825649
try looking at the stack trace of the exception... it wil give you line numbers in your code for where the problem happenned ...

as for other cases most exceptions are pretty clear with what went wrong. i.e. "Argument foo can not be null"
0
 
LVL 5

Author Comment

by:knowlton
ID: 10825687
The line numbers are not providing me with anything I can work with.

To see the practical application of my question, please visit my OTHER question:

http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_20953912.html


Tell me how knowing the line of code helps me solve the problem?  I am willing to learn if someone can explain to me step by step what to do to find the solution.

My sincere thanks!

Tom
0
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 400 total points
ID: 10825845
knowing the line number puts you on the line of code that failed ...

And in your other question ...
You attempted to use an enumerator on something that doesn't support IEnumerable this is fairly clear in the error however these are compile time errors ...
N:\ClientDevelopment\NEO\BuyersFund\WindowsServiceTrackRequestProgress\ServiceTrackRequestProgress.cs(93): foreach statement cannot operate on variables of type 'Outlook.Folders' because 'Outlook.Folders' does not contain a definition for 'GetEnumerator', or it is inaccessible

COMINTEROP Exception thrown inside function ProcessFailures.  Message:  Could not complete the operation because the service provider does not support it.::StackTrace:     at Outlook.NameSpaceClass.get_Folders()
   at WindowsServiceTrackRequestProgress.ServiceTrackRequestProgress.ProcessFailures() in n:\clientdevelopment\neo\buyersfund\windowsservicetrackrequestprogress\servicetrackrequestprogress.cs:line 102
t\neo\buyersfund\windowsservicetrackrequestprogress\servicetrackrequestprogress.cs:line 102

Your other exception sounds to me like the method is throwing an UnImplemented exception
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 8

Assisted Solution

by:RomanPetrenko
RomanPetrenko earned 100 total points
ID: 10825953
You can use anakrino to look in the sources of CORE .NET (not debug, but if you have sources they can explain a lot of problems). It's best tool I've ever see to decompile .NET assemblies...
Look here:
http://www.saurik.com/net/exemplar/
0
 
LVL 5

Author Comment

by:knowlton
ID: 10826051
Thanks Roman, I'll keep that as an option.

It is looking like I am using the wrong code....based on the other posts you have made in my other questions.

Like I said in my other post, I am using Outlook 2000 and VS .NET 2002.
0
 
LVL 5

Author Comment

by:knowlton
ID: 11119995
UPDATE:

Well, guess what?

I finally had a major breakthrough on this @!#$^% problem that has been driving me crazy for the last few weeks!!!!!!!


It is a very small change.

Apparently the method   MoveFirst(   ) does not work so well with Exchange.

This was the cause of my COMException:   "Interface not registered" error message this entire time.


The solution is to use    Move(1,0)     instead of MoveFirst(  ).


That's it.   Simple.

This answer came courtesy of Tom Rizzo, an author who was kind enough to correspond with me and help me figure-out finally what the problem was.:

Looking for a good book on programming Exchange, Outlook, ADSI and
SharePoint?  Check out http://www.microsoft.com/MSPress/books/5517.asp

My I also reommend:

.NET and COM: The Complete Interoperability Guide  ISBN:067232170X
http://www.amazon.ca/exec/obidos/ASIN/067232170X/componentsnot-20/701-9386310-4703553
0
 
LVL 5

Author Comment

by:knowlton
ID: 11120301
More on the MoveFirst problem I described:

http://support.microsoft.com/default.aspx?scid=kb;en-us;273791


If you are getting into Event Sinks....I recommend the following tutorial:

http://www.codeproject.com/csharp/CsManagedEventSinksHooks.asp

Make sure and read the article questions and follow-ups at the bottom!

There are a few caveats.  E-mail me at my Profile e-mail address and we can talk about them.  :)
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

813 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

20 Experts available now in Live!

Get 1:1 Help Now