Friday, August 29, 2008

Blog Popularity

This blog is near to cross 500 unique visitor per month :) finger crossed

How to Get Calling Assembly

I work on a product which has more than 80 assemblies call around each other. We have build with pdb file specially distributed to developers for debugging purpose but all are not so fortunate :)
It is obvious that you cannot be sure about which assembly you will need to compile in order to get full call stack. But with : System.Reflection.Assembly.GetCallingAssembly()

This way you get the calling assembly so you can compile that assembly. There are a lot of goodies to explore in System.Reflection.Assembly class for debugging.

Happy Debugging!!

Thursday, August 14, 2008

Change-Set Rollback using TFS Power Tool (tfpt.exe)

Have you made a booboo by checking in something which you shouldn’t have? If you are using TFS and TFS Power Tools (tfpt in short) installed on your system, you are still good to roll the s#%t back.
Here are the steps that you will need to follow:
1. Install TFS Power Tool. This is recommended as it provides a lot of goodies without which you may see hell some day.

2. ‘Shelve’ all changes, as you will have to ‘undo’ all your changes.

3. Open cmd prompt. Make sure your $path environment variable is configured to find tfpt.exe

4. Change directory to the workspace

5. Give this command: rollback /changeset:{Change-Set Number}
(For example rollback /changeset:39356)

6. It will take latest of all your workspace. This is what I don’t like as it doesn’t work otherwise. It takes some but works…

7. After above step, tfpt has taken older version and all those file will be ready to be check-in with older viersion.. Check-in those and take a tea.

Tip [02/24/2009]: Step 6 may kill you if you are storing huge amount of data into TFS. I advice you to create a new workspace with only required files downloaded. For Example, if your all changes are in '$codebase/folder/subfolder/" then create workspace for $codebase/folder/subfolder/ mapped to local directory C:\for_rollback\ Due to this, step 6 will become very fast.

Powertool help and website: http://msdn.microsoft.com/en-us/tfs2008/bb980963.aspx

Monday, August 11, 2008

NO to Extension Methods

Extension Methods are the coolest features of C# 3.0. Although it looks very power full, it is to be used stingily. There are multiple reasons behind that with Maintainability being the first.
  • You have to search the whole code base to find where you extension method is implemented.
  • There are complex rule based on which overriding of extension method works
  • Little more complex methods and you may put yourself into cyclic reference problem
  • For me and other users of Rhino Mocks beware as you cannot mock (fake) out extension method yet.

So you may ask me ‘When to use?’ If you come on conclusion that the usage of extension method in your case is die hard and alternatives are way too ugly, perffer oldschool otherwise… Happy Coding!!

Thursday, August 07, 2008

TFS Command Line

I do this get list of files of any shelveset into a text file:
Here is list of commands that you can use: http://blogs.msdn.com/buckh/articles/CommandLineSummary.aspx

Idiotic Software

Due to some issue I had to uninstall a Rating software. After uninstall is finished it put my PC into lull.. most of my customized commands went. Then it came out that the software uninstallation program removes all your $Path! How stupid! How can someone write a software like that? I don’t know how safe is my PC with that software. But as my work involves that software so I have deal with all these. It’s really frustrating!