Skip to main content

Posts

Showing posts from 2012

Debugging Windows Exceptions with Adplus V7

A tool called Adplus can be used on Windows to get more information on unexpected exceptions, hangs and crashes. If one of these has been reported on a production machine then run Adplus in the background, monitoring that process, and check from dump files afterwards. The dump files should include information on that happened just before the exception, crash or hang. The dump files can be opened in Visual Studio or Windbg for example and ran as a debugging session. There is a new version of Adplus available, Adplus V7 , it's an exe where the old was a vbs. Adplus comes with the "Debugging Tools for Windows", google this to find the latest version. First stop http://www.codeproject.com/Articles/315536/Adplus-Handling-managed-exceptions To get a dump on an exe use the -sc switch with adplus (ensure this is the last switch on the command line) and point it to the full path of the exe. If adplus is working it will launch the exe in a separate window, if not then it...

Immutable Objects

Immutable means "can not change". When an object is referred to as Immutable it means the internals cannot be changed i.e. it's member variables. This is a design choice, where you might wish objects to be passed around as method arguments but you do not want the original object's internal values to change. Remember that in C# when you pass an object of type Reference Type into a method as an argument, you are actually passing it by reference, meaning the method can change the original objects values. To protect objects  from this make them immutable. How: Objects are made immutable by simply making their internal variable readonly.

Dependency Injection IoC

"Dependancy Injection" is a more specific name for and term used "Inversion of Control". It's all about letting client developers of your code add there own implementations. To do this your code needs to be very loosly coupled (i.e. none of the usual newing up of concrete classes, the code must be written using Interfaces for example) and configurable (e.g. the client developer drops their implementation dll into a location and adds content to a XML configuration file to tell your host app what class to load and instantiate from the dll). This is a good intro to "Dependancy Injection"  http://www.martinfowler.com/articles/injection.html These are intros to Microsofts "Dependancy Injection" framework, Unity. https://www106.livemeeting.com/cc/wwe_us/view?cn=guest&id=1032382093&pw=23D44136  with sourcecode at  http://unity.codeplex.com/wikipage?title=Webcast%20demos&referringTitle=Home http://visualstudiomagazine.com/ar...