Solved

Fully exploring exceptions using the Debug Windows

Posted on 2004-04-14
7
213 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

762 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

19 Experts available now in Live!

Get 1:1 Help Now