Finding CLR exceptions without visual studio

(If you want to understand what exception code 0xe0434352 is, read this post)

Often exceptions are thrown and caught and you don't see them. You probably know how to debug this in Visual Studio, so let me show you how to do it in cdb.
Sample Code:


class Program
{
 static void Main(string[] args)
 {
     foreach (var x in Enumerable.Range(0,2000))
     {
         Thread.Sleep(TimeSpan.FromSeconds(1));
         Console.WriteLine("Hello World");
         ThrowAndCatchException();
     }

 }

 private static void ThrowAndCatchException()
 {
     try
     {
        throw new NotImplementedException();
     }
     catch(Exception)
     {
     }
 }
}
Output of the application:
Hello World
Hello World
Hello World
Nothing about an exception, but you're sure it's happening behind the covers -- fire up cdb:
C:\Program Files\Debugging Tools for Windows (x64)>cdb -pn consoleapplication3.exe

<SNIP>

ModLoad: 000007fe`f7e90000 000007fe`f7eb4000   C:\Windows\Microsoft.NET\Framework64\v4.0.20506\culture.dll
(ff8.17a8): Break instruction exception - code 80000003 (first chance)
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Windows\SYSTEM32\ntdll.dll -
ntdll!DbgBreakPoint:
00000000`77b7d7b0 cc              int     3
Continue debugging:
0:004> g
Exceptions - lots of them:
(ff8.16dc): CLR exception - code e0434352 (first chance)
(ff8.16dc): CLR exception - code e0434352 (first chance)
(ff8.16dc): CLR exception - code e0434352 (first chance)
(ff8.16dc): CLR exception - code e0434352 (first chance)
(ff8.16dc): CLR exception - code e0434352 (first chance)
(ff8.16dc): CLR exception - code e0434352 (first chance)
(ff8.1860): Break instruction exception - code 80000003 (first chance)
Break on CLR exceptions:
0:004> sxe clr
0:004> g

(ff8.16dc): CLR exception - code e0434352 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Windows\system32\KERNELBASE.dll -
KERNELBASE!RaiseException+0x3d:
000007fe`fdb8bb5d 4881c4c8000000  add     rsp,0C8h
Load sos ( in .Net 2/3 use use !loadby sos mscorwks):
0:000> !loadby sos clr
View Stack:
0:000> !CLRStack
PDB symbol for clr.dll not loaded
OS Thread Id: 0x16dc (0)
Child SP         IP               Call Site
000000000096e6a8 000007fefdb8bb5d [HelperMethodFrame: 000000000096e6a8]
000000000096e7c0 000007ff00170360 ConsoleApplication3.Program.ThrowAndCatchException()
000000000096e810 000007ff001701fb ConsoleApplication3.Program.Main(System.String[])
000000000096ec90 000007feef474ca4 [GCFrame: 000000000096ec90]
View Exception:
0:000> !PrintException
Exception object: 0000000002c88c18
Exception type:   System.NotImplementedException
Message:          The method or operation is not implemented.
InnerException:   <none>
StackTrace (generated):
<none>
StackTraceString: <none>
HResult: 80004001
0:000>
Pretty neat - eh?

Comments

Michael DePouw said…
Sweet, thanks!!!!
Rune said…
Thank you for this nice tips. It helped me solve a very frustrating problem when trying to deploy an C# app :)

And more importantly I'm now able to debug more effectively in the future.
couldnt understand anything .... pls tell me how to solve this problem ....?
Unknown said…
while am shuting down the windows its showing me like

"The exception unknown software exception (0xe0434352)occurred in the application at location 0x850f89cc"

i doesnt know what to do now please help me...!!
Paf said…
Same situation . Can't someone speak in lay men's terms speaking slowly and all steps needed.
njg123456 said…
Repeat of previous comment. How do I fix this "error". It affects Kaspersky Internet Security.
Yak said…
This totally just helped me solve my problem.

Thanks so much!
Unknown said…
The Constitution only gives people the right to pursue happiness. You have to catch it yourself. See the link below for more info.

#catched
www.ufgop.org
Unknown said…
If you are not willing to learn, No one can help you. If you are determined to learn, No one can stop you.
imarksweb.net
Very Nice Detail And Good Article Thanks for posting .keep updating us.wonderful great blog. We offer the most budget-friendly quotes on all your digital requirements. We are available to our clients when they lookout for any help or to clear queries.

Best SEO Services in Chennai | digital marketing agencies in chennai | Best seo company in chennai | digital marketing consultants in chennai | Website designers in chennai
moumita said…
Thanks for sharing nice article. I likes your post. Such a nice content. Thank you so much for the post it is very helpful, Keep posting such type of articles.

Free DoFollow Travel Blog Commenting Sites
Anonymous said…
great post keep updating with us.wonderful article.River Group of Salon and spa, T.Nagar, provide a wide range of spa treatments, like body massage, scrub, wrap and beauty parlour services. We ensure unique care and quality service.

massage in T.Nagar|body massage T.Nagar|massage spa in T.Nagar|body massage center in T.Nagar|massage centre in chennai|body massage in chennai|massage spa in chennai|body massage centre in chennai|full body massage in T.Nagar
Revathi said…

Thanks for providing a useful article containing valuable information. it is very useful blog for others also.keep on updating us.
sharath said…
Thank you for sharing your article. Great efforts put it to find the list of articles which is very useful to know, Definitely will share the same to other forums.
Java Training in Chennai

Java Training in Bangalore

Java Training in Hyderabad

Java Training
Java Training in Coimbatore


un known said…
Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website
sap lumira online training
best sap lumira online training
top sap lumira online training
Mia Paul said…
Aimore Technologies is the best Selenium training institute in Chennai with 6+ years of experience. We are offering online and classroom training.
Visit Us: Selenium Training in Chennai
Cyberz Pc said…
indeed i'm entirely actually later this article and that I basically pulsate declare that this pamphlet is totally conceivable and truely educational article.i will make specific to peruse your weblog more. You made an unadulterated moderation anyway I can't assign dissipate to anyway surprise, what roughly the shiny new feature? !!!!!!thanks Microsoft Office 2016 Product Key Crack
unknown said…
Thank you very much for this useful article. comme des garcons I like it.
lakshmi said…
Extremely Nice Blog… Thanks for offering this data to us. Here am sharing some data about preparing foundation.
visit us: -swhizz
our services: -
Salesforce
DevOps
aws
Testing
Java

Sruthi Karan said…
Your blog was really good and I gain good knowledge from your post. Good work!
Divorce in Virginia with Child
Divorce Attorney in Fairfax
London Fashion said…
Thanks for sharing this blog. This article gives a lot of information. Trapstar London ,Trapstar Coat ,Trapstar Tracksuit
I am very happy to read this article. Thanks for giving us Amazing info. Fantastic post.Trapstar Official ,Trapstar Jackets ,Trapstar Tracksuit
Thankyou for sharing this great article. I am also appreciate you. Thanks Game of Thrones Swords, Wrestling Belts

Great article! I'm impressed with the quality and functionality of this product. Highly recommended for everyone wwebelts.shop
Thanks for the detailed information. I'll definitely implement this in my strategy. For more information visit my this site

Popular posts from this blog

Why do I keep getting exception code e0434352?

Powershell script to enable windows to capture localhost traffic in wireshark