Friday, April 4, 2014

What is "a first chance exception"

I've done some apps that works in a multithreaded environment, and while debugging them, I found out several “first chance exception” was seen at my output window.in Visual Studio. So what is a first chance exception? Is it harmful?


Quoting from a blog on MSDN website.. 

What is a first chance exception?
When an application is being debugged, the debugger gets notified whenever an exception is encountered  At this point, the application is suspended and the debugger decides how to handle the exception. The first pass through this mechanism is called a "first chance" exception. Depending on the debugger's configuration, it will either resume the application and pass the exception on or it will leave the application suspended and enter debug mode. If the application handles the exception, it continues to run normally.
In Visual Studio, you may see a message in the output window that looks like this:
 A first chance exception of type 'System.ApplicationException' occurred in myapp.exe
 In Visual Studio 2005 Beta2, you will see this message anytime a first chance exception is encountered in your application's code.  If you are using Visual Studio .NET 2003, this message is shown if you have configured the debugger to stop when the specific exception type is thrown. If the application does not handle the exception, the debugger is re-notified. This is known as a "second chance" exception. The debugger again suspends the application and determines how to handle this exception. Typically, debuggers are configured to stop on second chance (unhandled) exceptions and debug mode is entered, allowing you to debug. 

Does a first chance exception mean there is a problem in my code? 
First chance exception messages most often do not mean there is a problem in the code. For applications / components which handle exceptions gracefully, first chance exception messages let the developer know that an exceptional situation was encountered and was handled. For code without exception handling, the debugger will receive a second chance exception notification and will stop with a unhandled exception.

Source: from very old article dated 12 Jul 2005 (link)

While, it may not be harmful, it is however, an indication that something wrong happened in your software and may need some extra attention to handle it properly.

Thursday, April 3, 2014

Microsoft Build Event

I didn't realize that last night (MY time) was the starting date for Microsoft's Build event, until I saw in an email notification of mine..

Not in the mood to turn on my PC to watch the keynote, I did it on my Lumia..


Live streaming screenshot taken from my Lumia..


Day 1 saw a hefty load of interesting topics. But I was more keen on "Universal Xaml language and TypeScript.

The former, being a great thing to many win phone developers, we can now target  apps for Windows 8.1 as well.. That's a good thing as you don't need to write two different xaml apps - potentially some tweaking is needed nonetheless. I've blogged before that IOS and Android already have this capability, but for me, coming from a .NET developer point of view, it is something worth waiting for - albeit a bit late in the game.

The latter, on the other hand is something I look forward to see more. What is Typescript?

TypeScript is a free and open source programming language developed by Microsoft. It is a strict superset of JavaScript, and adds optional static typing and class-based object-oriented programming to the language. Anders Hejlsberg, lead architect of C# and creator of Delphi and Turbo Pascal, has worked on development of TypeScript.
reference: wikipedia

I don't know anything about TypeScript although I've heard people talking about it. My bet is it has something to do with javascript and web development... I might just look into it as well in the near future...


I'll write more on this.. so stay tuned..