Exceptions Management (or lack of it)

A good example of what not to do.

February 3, 2009 · 1 min · Amit Bahree


Did you know there is a new method called DragMove which is part of the Window class and allows you to move the window using a mouse? I certainly did not - till now. This is part of .NET 3.0, specifically part of WPF and . Here is an example from the SDK: 1 2 3 4 5 6 7 protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) { base.OnMouseLeftButtonDown(e); // Begin dragging the window this....

November 13, 2006 · 1 min · Amit Bahree

Writing High-Perf. Managed Apps?

If you are writing high-perf. managed applications, all the old-world advice from the days of good old COM is still valid. But you do need to think of a few other things such as how the CLR JIT would change things, or the Exception Handling, or Threading and syncing up, or possibly the GC and Allocation Profiles? While this MSDN article is old (now), it still is excellent Food for Thought when it comes to writing high-perf....

January 3, 2006 · 1 min · Amit Bahree

Exception Management in Threads

Exception Management is a topic near and dear to me personally, primarily because of the lack of understanding of most developers (that I have come across). There is an interesting change in the .NET 2.0 CLR on how it manages unhandled exceptions in a thread. If you write multi-threaded apps then this is important for you to understand. If you don’t write multi-threaded apps today, but I presume you would soon, then this is a good learning exercises....

December 31, 2005 · 2 min · Amit Bahree

Execution Context

It is quite interesting to see how many people don’t understand the basics of threading, while it is a difficult topic (especially to debug), and it is not the silver bullet for all the problems, but it sure is quite handy for certain things. With the inevitable shift to multi-core CPU’s and the release of Vista to take better opportunity of these extra power, more applications in the future should be ready to exploit them....

December 27, 2005 · 4 min · Amit Bahree

System.Transactions and Timeout

Cross posting from All about Interop ; System.Transactions has two timeout values that you can specify in configuration files. The default timeout for System.Transactions transactions is 1 minute. You can set it in either app config, web config, or machine config. (You can also set the timeout for a particular transaction programmatically within the application, by using one of the appropriate constructors for TransactionScope or CommittableTransaction). Setting the default timeout to 30 seconds in config code looks like the following....

December 16, 2005 · 2 min · Amit Bahree

Secure Startup Volume Encryption in Vista

It has been long overdue and now its finally present. Vista has something called the Secure Startup Volume Encryption which will work on computers with the Trusted Module Platform (TPM) chip. Here, all except the bare minimum of the boot volume is encrypted and at boot time the TPM transparently allows access to the drive. If someone either removed the hard disk and puts it in a different machine or attempts to boot from a different OS, the disk will be unreadable without a password....

August 16, 2005 · 1 min · Amit Bahree

Profilers for the CLR

Brad Adams lists out a few options for Profilers available in the CLR - some of these possibly are familiar to you - but its good to see them listed in one place. (got this via Jon Kale who was responding to something else).

June 28, 2005 · 1 min · Amit Bahree

Inside regsvc.exe

Ever wondered what is happening inside regsvc.exe? Well so did Tomas Restrepo, and here is what he found out.

March 24, 2005 · 1 min · Amit Bahree

System Programming?

If you ever wanted a quick sample of some system programming - something you know is fairly simple to do but did not have the time to do it from scratch - just something quick and dirty, then you should check out this link - which has all the basic stuff Thread Pools, Waitable Handles, Monitors, Secure Remoting channel, etc.

March 24, 2005 · 1 min · Amit Bahree

Getting Started With Enterprise Library

If you recall I had recently posted about the release of Enterprise Lib. My colleague, Hisham Baz has a post on how to get started with the Ent. Lib . If you are new to it and want to know more about it, that is a good place to start. [Listening to: Boy in the Well - R.E.M. - Around the Sun (05:22)]

February 9, 2005 · 1 min · Amit Bahree

Tips and Trips for .NET Compact Framework

Dave and John discuss various aspects of the .NET Compact Framework (CF) where in addition to the list belowthey cover things like the fastest way to splat text onto the screen? ExtTextOut using which you can draw text based on the currently selected font, background color, and text color. You can optionally provide dimensions to be used for clipping, opaquing, or both. It can also draw with a transparent background, which labels in the ....

January 6, 2005 · 2 min · Amit Bahree


If you ever thought that PInvoke was a pain in .NET, don’t fret, Adam Nathan has a VS.NET addin that you can get from here after using which you wondered, how the heck did I live without this! He also has a PInvoke.NET wiki for you to use and of course contribute to. If you rather get to it yourself, then there is an wsdl endpoint exposed and Stripe has written a version that is proxy friendly ....

December 15, 2004 · 1 min · Amit Bahree

Tracking down managed memory leaks (how to find a GC leak)

At work, recently I attended an excellent presentation given by a colleague where we talked about Debugging in general (across both Managed and Unmanaged code), and what the various categories are, and various tools at ones disposal, etc. I thought this post from Rico on how to find GC leaks was quite timely for that topic. [Listening to: City of Blinding Lights - U2 - How to Dismantle an Atomic Bomb [Bonus Track] (05:48)]

December 15, 2004 · 1 min · Amit Bahree

Assembly signing changes in VS 2005

Bruce has a post (which I verbatim here) highlighting one of the small changes in Whidbey which will make life easier for a whole bunch of us. In Whidbey, the name of the .snk file is included as a property on the project and is picked up my msbuild when compiling. To get to it: Right-click on the project in the solution explorer and select Properties. Click on the Signing tab....

September 30, 2004 · 2 min · Amit Bahree

.NET Service Pack 1 can break HttpWebRequest

If you installed .NET Service Pack 1 you might notice that certain RSS feeds are broken and might return an HTTP Protocol Error. As Dare suggests , this is due to the fact that the HttpWebRequest class has been modified to make it more compliant to the HTTP spec. E.g. on the MS research feeds, this errors because the server returns the Content-Location header as “Content Location” (notice the space as opposed to the hyphen)....

September 5, 2004 · 1 min · Amit Bahree

Writing Windows-Shell Extensions using .NET

Dino writes an interesting <strong>article</strong> on how to write shell extensions in managed code. He also provides a brief overview of COM Interop covering both CCW (COM Callable Wrappers) and RCW (Runtime Callable Wrappers), which those of you who have had any experience with COM know has a fair amount of overheard and though is quite seamless to use, it is not to be taken lightly especially if you have custom data types in COM....

July 2, 2004 · 1 min · Amit Bahree

Invoking Google's web service on a Smartphone

Incase you did not hear, then which planet are you living on, but Google exposes their offering via a <strong>Web Service</strong> that you can use to search for … well … stuff. If you have programed on the .NET CF then you know this is quite simple (especially if you program on the “regular” .NET). Incase you have not dabbled in this and are interested in doing something simple then check out <strong>this</strong> article which steps you thru the simple application....

June 7, 2004 · 1 min · Amit Bahree

Mono Beta 2

About a month after releasing the first beta, Mono <strong>released</strong> the second beta that includes a c# compiler which is CLI compliant and also supports the same PE system as .NET. What is more interesting is that there are two stacks of APIs one for the Unix and its variants and the other is of the .NET Framework (v 1.1) to support ASP.NET including WebForms, WebServices, among other things. The beta2 includes:...

June 3, 2004 · 2 min · Amit Bahree