Skip to main content


Showing posts from February, 2010

Team Explorer is Included in Visual Studio 2010

I noticed yesterday after installing Visual Studio 2010 on my home system that Team Explorer is included.In previous releases, Team Explorer (the client for TFS) was a separate installation.  In VS 2010, it’s now included in the setup for Visual Studio Professional, Premium, and Ultimate.  This means you don’t have to run the stand-alone Team Explorer setup afterwards.  A separate installation package still exists for users who need to interact with TFS but don’t need all the other features of Visual Studio.

Testing waithandles in MSTest

For a client I needed to write a parallel execution mechanism that executes multiple tasks at the same time on different threads but further execution had to wait before all threads signals complete. In this situation, synchronization becomes very important,  so I used the WaitHandle classes to implement this functionality. As no code is complete without good unit tests, I added a test to validate the behavior of the waithandles: 1: [TestMethod] 2: public void Waithandle_Should_Wait_Until_All_Tasks_Complete() 3: { 4: Action task1 = ()=> DoSomething(); 5: Action task2 = ()=> DoSomething(); 6: Action task3 = ()=> DoSomething(); 7: 8: IAsyncResult result1= task1.BeginInvoke( null , null , null ); 9: IAsyncResult result2= task2.BeginInvoke( null , null , null ); 10: IAsyncResult result3= task3.BeginInvoke( null , null , null ); 11:   12: WaitHandle.WaitAll( new WaitHandle[]{result1.AsyncWaitHandle, r

Cannot initialize the ASP.NET project

After enabling Code Coverage on a Web Application, our build showed up red :-( The build log on our TFS 2010 Build Server showed us following information:   Run has the following issue(s):          Cannot initialize the ASP.NET project 'Project.Host'.          Exception was thrown: The web site could not be configured correctly; getting ASP.NET process information failed. Requesting 'http://localhost:1709/VSEnterpriseHelper.axd' returned an error: The remote server returned an error: (500) Internal Server Error. ….      Done executing task "TestToolsTask" -- FAILED. 1:7>Done building target "CoreTestConfiguration" in project "TFSBuild.proj" -- FAILED. I couldn’t find a good solution, so I had to disable the code coverage on the web project. No idea what could be wrong…

Windows Phone 7 Series

Microsoft finally announced his answer on the Apple IPhone and the Google Android. Interested? Try out the new user interface and functions here . 

TFS 2010 RC Power Tools

Microsoft released this Monday an update of the TFS power tools for the TFS Release Candidate. Here are the download locations: Power Tools MSSCCI Provider

MSTest Improvements in TFS 2010

After installing the Release Candidate bits in our development environment, I found out a very great improvement. The output information from MSTest, used when running unit tests, is finally nicely integrated in the build report. Before you only got an error like this when running the tests failed MSTest.exe returned an exit code of 1 indicating that not all tests passed. Now you get a full report containing all the tests and their results, any errors and every other information you could ever need. Great!

HTML: love it or hate it.

HTML is a great language but sometimes designing web applications drives you nuts. Last week I had an issue with a menu list I created in a website. For a strange reason it always showed two pixels of whitespace between each menu item. Whatever I did or changed in the CSS, nothing seemed to work. Same issue for Firefox and IE. The HTML looked something like this: 1: < ul > 2: < li >< a href ="#" > Home </ a ></ li > 3: < li >< a href ="#" > File </ a ></ li > 4: < li >< a href ="#" > Project </ a ></ li > 5: < li >< a href ="#" > Build </ a ></ li > 6: </ ul > 7:   By accident I found out that putting the li on one line did the trick. 1: < ul > 2: < li >< a href ="#" > Home </ a ></ li >< li >< a href ="#"

Unity 2.0

With the release of the beta of Unity 2.0, I took a quick look at the new/changed features. Things I’ve noticed: The objectbuilder is gone: The dependency on the ObjectBuilder2 assembly is removed and most of the code is now incorporated in the core assembly.   Configuration support: Unity configuration can be done using the Enterprise Library configuration tool. IsRegistered extension method: Checks if a type is already registered in the container. Can be useful in some situations where you want to avoid multiple registrations overriding each other. Registrations collection: Similar to the diagnostics feature in StructureMap, you can now inspect the available registrations. New lifetime managers: HierarchicalLifetimeManager and PerResolveLifetimeManager are added. In a future post I look into more detail in some of this features. I especially hope to find some improvements in passing arguments when resolving types.

Scrum for Team System – Visual Studio 2010 RC

The guys from the Scrum for Team System template released an update version for the Visual Studio 2010 Release Candidate. Scrum for Team System v3 RC x86 Process Template Scrum for Team System v3 RC x64 Process Template Scrum Masters Workbench RC x86 Desktop Utility Scrum Masters Workbench RC x64 Desktop Utility

Using a password control in WPF

Last week I was building a simple WPF application with a login screen. In WinForms you could easily change a textbox to behave like a password control. In WPF I found out that I could use the PasswordBox. But this control misses one very important feature, you cannot do databinding on it. Say goodbuy to use MVVM out-of-the-box. Anyway I followed this very easy tutorial to attach databinding behavior to the PasswordBox.

'MSTest.exe' returned '128' on TFS 2010 Build server

Last week our build failed sometimes even when all conditions were met(code compiled, all tests were running,…). In the build log I found following errorline: TFB210610: 'MSTest.exe' returned an unexpected exit code. Expected '0'; actual '128'. Running MSTest manually on the build server using the same parameters gave no errors. On MSConnect I found out that I was not the only one encountering this issue. It should have been resolved in the Visual Studio 2010 Release Candidate. I’ll check it out next week.

Configuring SSL in IIS 7

To secure an ASP.NET MVC website I used SSL in IIS 7. So I selected the installed certificate in the bindings, enabled SSL on the website and thought that I was good to go. But after browsing to the website I got following error: There was an error while performing this operation. Details: A specified logon session does not exist. It may already have been terminated. I found out that errors happens when you import the certificate using the IIS7 Server Certificates and de-select the option to Allow this certificate to be exported. In that case it is not possible to use the certificate inside IIS7. So I removed the certificate, re-installed it with the option enabled and everything worked fine!

Authorization Manager aka AzMan

One of the most useful tools in my toolset is AzMan, the Microsoft Authorization Manager. It can be used to set or change permissions and configurations at a high level, including making several changes simultaneously. It performs some of the same functions as other familiar tools, such as the ACL Editor and Delegation of Control Wizard (for user roles) and the Configure Your Server Wizard (for computer roles). However, Authorization Manager gives you more control and lets you go farther than these tools. You can create a custom MMC and add the Authorization Manager snap-in, or you can open the predefined Authorization Manager console by typing azman.msc at the command prompt or Run box. As AzMan is also included in the Microsoft Enterprise Library Security Application Block , it becomes very easy to integrate in your own applications.

Test Impact Analysis in Visual Studio 2010

Last week I gave an introduction on the new features in Visual Studio 2010. One of the things I showed was the Test Impact Analysis. Sadly my demo failed, because of a corrupt testsettings file as I found out later. Inside of Visual Studio, this feature is used to immediately inform the developer of what tests they should run to verify the code changes they are making.  You can also find the feature as part of Team Foundation Build and Microsoft Test and Lab Management, so you can collect the same information when running automated tests on your build server and even manual tests from within the lab manager! As most of my projects are large scale, only have to run a subset of tests saves us a lot of time(especially our test team). Some interesting links: Enabling the Test Impact Analysis inside Visual Studio: Enabling the Test Impact Analysis on the build server:

ASP.NET MVC Quick Tips

Nuno Silva, a Microsoft engineer did an interesting blog series about the usage of the upcoming ASP.NET MVC 2 release. He focuses on a solid implementation of an edit view, including both client and server-side validation, as well as showing how to avoid some common pitfalls.

SQL Profiling

As we were encountering some performance issues, I wanted to investigate some sub-optimal queries. First help is always the SQL profiler that can help you monitor your live database and give some advice based on the captured results. But the profiler failed to run on the selected database. Some research revealed that you need some extra permissions to get a profile session up and running. Execute therefore following script on your database: 1: USE master 2: GO 3: GRANT ALTER TRACE TO username; 4: GO

NDbUnit v1.6 supports Oracle

A new version of NDbUnit was released and Oracle support has finally been integrated. This now brings the complete list of supported DB targets under NDbUnit to six: Microsoft SQL Server (including Express Editions and on up to Enterprise) Microsoft OleDb -supported databases* Microsoft SqlServerCe /Mobile Edition/whatever its called this month MySql Oracle (including XE and on up to Enterprise) SqlLite (including both on-disk and in-memory variants)

SmtpClient deliveryMethod

One of the nice but little known possibilities of the System.Net.Mail. SmtpClient class is the ability to drop emails into a location on disk. This makes it very easy to test your code without the need of an SMTP server. Update your app.config or web.config like this: 1: < > 2: < mailSettings > 3: < smtp deliveryMethod ="SpecifiedPickupDirectory" > 4: < specifiedPickupDirectory pickupDirectoryLocation ="c:\mails\" /> 5: </ smtp > 6: </ mailSettings > 7: </ > You can also configure this setting on the class itself. Files are dropped on the specified location and can be opened using Outlook Express or Windows Mail.

SQL Server – Get current user

Today I needed to know the current user while executing a trigger to write some audit data. Getting the current user is very easy using following statement: 1: SELECT SYSTEM_USER SYSTEM_USER will return the  name of the currently executing context. If the EXECUTE AS statement has been used to switch context, SYSTEM_USER returns the name of the impersonated context.

Enterprise Library 5 and Unity 2 Beta 1

After a very long silence, we finally hear again from the Microsoft Patterns & Practices team. They just released both Enterprise Library 5 Beta 1 and Unity 2 Beta 1. There a lot of improvements, I especially like the easier configuration and we finally got rid of the objectbuilder. Downloads here: Enterprise Library 5 Beta 1 Unity 2 Beta 1  

VS 2010/.NET 4.0 RC

Start your download engines! Microsoft made available the VS2010 and .NET 4.0 release candidates. You can find download links here . Right now the downloads are available only to MSDN subscribers.  Starting Wednesday (Feb 10th) everyone will be able to download them (regardless of whether you are a MSDN subscriber or not). More info here .

Sharepoint sucks… or that is what some people are saying

For some strange reasons, people get very religious when it comes to loving or hating Sharepoint development. Bjørn Furuknap did a great blog series on this discussion. Read al posts to get the point…

Multiple endpoints for a WCF service hosted in IIS

Last week I had to deploy a service with multiple endpoints in IIS. In this case my WCF service has 2 addresses, a base address and an endpoint address. The base address is used for meta data. It matches to the SVC file we’ve created to host our service in IIS. So if a consumer uses our service. It will extract the WSDL metadata from this address. In your browser you will only be able to access the base address. For example, http://localhost/IBuySpy/OrderService.svc Inside your service,you can have an address for each endpoint. When you are actually calling the service, you will not be using the base address but one of endpoint address.  Most of the time I configure my service so that for one address the base address and endpoint address are the same. So when you are calling the service from a client app,you can use both addresses, http://localhost/IBuySpy/OrderService.svc http://localhost/IBuySpy/OrderService.svc/Endpoint2 The corresponding service configuration will look like this:

Junior developers

The last months I had to do a lot of coaching. It made me realize that it’s really hard to teach someone something you have done for years. You sometimes forget what it' is like to be a junior, you just can not understand why, what for you seems like “the simplest fundamentals”, is hard to grasp for someone else. Some rules that I try to apply: Do not take over -  It can be really hard sometimes to not take control of the mouse and keyboard and show them what to do. But we all learn the most from our mistakes, so let them try some stuff, if it fails you can fix it together and they will understand why it didn’t work.   Show the path – Try to direct them to the path of the solution without revealing it. Draw things and have conversations, ask questions such as “what do we want to do now?” or “what do we want to accomplish?” or “What is the error we are getting? and what should we do to fix it?” Be ready to learn – I learned something from every person I worked with.

NHibernate guides

NHibernate is a really great ORM. But finding up to date documentation, good tutorials, and useful blog posts is hard. Tomasz Modelski did a really great job creating a compilation of various NHibernate guides, help topics, walkthroughs,… If you are using NHibernate today, certainly add this link to your bookmarks.


I just found this nice tool called CopyPasteKiller that helps you find duplicate code in your applications. I’ve been a user of Simian -  Similarity Analyzer for a long time, but this tool looks promising. CopyPasteKiller is a free tool for .Net developers that will analyze a directory of code and find large chunks of similar code in multiple locations. This similar code can then be refactored either by creating a base class or by reducing the protection level on the method so it can be called by multiple classes. Technically, CopyPasteKiller should be called CopyPasteFinder because its up to you to remove the duplicate code, but CopyPasteFinder isn't nearly as fun a name as CopyPasteKiller. I think I have an extra tool in my toolbox from today on.

Visual Studio 2010 and Oracle

One of the Visual Studio Team System version is the Visual Studio Database Edition for Database Professionals. This offered great functionality to manage your database scripts and version, generate testdata, run database unit tests but…only on SQL Server. With TeamFuze support will also be available for Oracle databases starting from the Visual Studio 2010 edition. So if you are using Oracle and interested in al the Visual Studio Database features, download the beta here .

Code Coverage issues with Team Build

Allergic to failing builds, I always look at ways to stabilize our build process. Of course this is if the tooling doesn’t start to work against us. Last month we had some failing builds because the code coverage process was not closed thereby keeping the coverage files locked. This resulted in following error: The process cannot access the file ‘data.coverage' because it is being used by another process. Killing the VSPerfMon.exe process on the build server solves the problem but I don’t think we can see this as ‘the solution’. I haven’t find an alternative yet, so all ideas are welcome. And of course this only happens in some occasions. Some people complained about the same issue on the MSDN forum .

Complex bugs and multithreading

If you are using unit test, you should know that every test is executed on it’s own thread. Last week I had a strange error where two tests failed(sometimes). Both tests were using an EventWaitHandle to do some synchronizationruns. If I both tests by themselves, the test run was successful. However, if ran them together, then I got the following error: Test method threw exception: System.ObjectDisposedException: Safe handle has been closed. I found out that the two tests were sharing an EventHandler. The first test raises an event and dispose itself. But in my code I never unattached the event handler . So when the second test raises the event, the eventhandler still thinks that there are 2 methods to call, not just one. After changing the code to properly detach the event, everything was working. So unittests are also a good test to check if your code is thread-safe.