Skip to main content


Showing posts from December, 2010

TF266044: One or more machines are not ready to run workflows.

When configuring a new lab environment for a client, I encountered the following error: Environment message: Type=Error; Message=TF266044: One or more machines are not ready to run workflows. For more information, see the individual machine errors.; Machine messages: Machine name: XXXXXX Machine message: Type=Error; Message=Error occurred while configuring TFSBuildServiceHost with Lab configuration. ExceptionType:Microsoft.TeamFoundation.Build.Client.BuildServiceHostAlreadyExistsException. ExceptionMessage: A build service host already exists for computer Specify a different computer name and try again. I found the solution in the following blog post ( ). Although our TFSenvironment wasn’t upgraded from the Beta 2, the fix still works if you encounter this error message.

Export mapping files generated by Fluent NHibernate

If you are using  NHibernate , you probably also heard about Fluent NHibernate which allows you to create your object-relational mapping from a mix of conventions and code instead of using error-prone XML files. Although you’re using a completely different API under the hood the same old XML files still exist. Sometimes it would be handy to view the NHibernate mapping files generated by Fluent NHibernate.It turns out that this is quite easy and you will just need to add a call to the method ExportTo() and then the mappings will be created in the location specified. 1: private static ISessionFactory CreateSessionFactory() 2: { 3: string outputdir= Path.Combine(System.Environment.CurrentDirectory, "Mappings" ); 4: 5: return Fluently.Configure() 6: .Database(SQLiteConfiguration.Standard.InMemory().ShowSql()) 7: .Mappings(M => M.FluentMappings.AddFromAssemblyOf<SessionFactory>() 8: .ExportTo(outputdir)) 9

Distributing check-in policies across your team

One of the nicest features of Team Foundation Server are the check-in policies. They allow you to validate specific rules before each check-in. What makes this even nicer is that you can easily write your own check-in policies. However there is one problem, the check-in policy(read: DLL) needs to be installed on the developer machine. This is important because if developers do not install check-in policies they would not be run during a Check-in. Before you start inventing the most complex deployment strategies to get the latest version of these policies on the developer machines, note that there is already a feature available, included in the TFS power tools . After installing power tools , a new node is added in Team Explorer called Team Members . Right click in the Team Members node and choose Personal Settings . From there you can see all the options for the collaboration features and one interesting option called Install downloaded custom components . This extension veri

Impress your colleagues with your knowledge about… PDB files

Most developers know that PDB files help you in some way with debugging, but that's about it. They are a dark art for most developers only completely understand by a few evil magicians. Let me help you understand what PDB files are and how they can help you making your debugging experience a lot easier. First read the following 3 important rules and never forget them! Rule 1 – PDB files are as important as source code First and foremost PDB files are as important as source code! Debugging bugs on a production server without finding the matching PDB files for the deployed build can cost you tons of money. Without the matching PDB files you just made your debugging challenge nearly impossible. Rule 2 – As a development shop, I should have a Symbol Server At a minimum, every development shop must set up a Symbol Server. A Symbol Server stores the PDBs and binaries for all your public builds. That way no matter what build someone reports a crash or problem, you have the exact

WCF vNext: Linq to WCF

One of the great new features coming to WCF vNext is the ability to expose a service through an IQueryable interface. This introduces the rich query model of OData to your own WCF services. How does this work? Making the service queryable On the server side, your service operation should return an IQueryable<T>. Annotate the operation with the new [QueryComposition] attribute. Once you do that, your service becomes queryable using the OData uri format. 1: [WebGet(UriTemplate = "" )] 2: [QueryComposition] 3: public IQueryable<Customer> Get() 4: { 5: return customers.AsQueryable(); 6: } The Get method above returns an IQueryable of customers. With the query composition enabled, the host will now accept requests like “http://localhost/customers?$filter=Countrye%20eq%20Belgium” which says “find me all the customers from Belgium”. Querying the service, LINQ to WCF On the client side Microsoft added a CreateQuery<T> extension

Boost the performance of your ASP.NET and WCF applications

By default both IIS and WCF are somewhat restrictive in their default settings. Executing a large number of concurrent call’s will not have much effect as by default only 2 concurrent connections per IP are allowed. However there are some simple configuration changes that you can make on machine.config and IIS to give your web applications significant performance boost. These are simple harmless changes but makes a lot of difference in terms of scalability. To learn how to do this, read this article “Quick ways to boost performance and scalability of ASP.NET, WCF and Desktop Clients” written by Omar Al Zabir .

ThreadStatic and ThreadLocal<T>

For a long time I was using the Thread­Sta­tic attribute to make the value of a sta­tic or instance field local to a thread (i.e. each thread holds an inde­pen­dent copy of the field). Although this did the trick for a long time, the ThreadStatic attribute had some disadvantages: the Thread­Sta­tic attribute doesn’t work with instance fields, it com­piles and runs but does nothing.. fields always start with the default value With the release of C#  4 Microsoft intro­duced a new class specif­i­cally for the thread-local stor­age of data – the ThreadLocal<T> class: 1:   2: ThreadLocal< int > _localField = new ThreadLocal< int >(() => 1); 3:   So why should you choose the ThreadLocal<T> class? Thanks to the use of a factory function, the val­ues are lazily eval­u­ated, the fac­tory func­tion only executes on the first call for each thread you have more con­trol over the ini­tial­iza­tion of the field and you are able to ini­tial­ize the field

How to be a bad programmer?

People always learn the most from their mistakes. So when talking about what defines a good programmer versus what defines a bad programmer, it’s sometimes interesting and easier to discuss what makes someone a bad programmer instead of a good one. Giorgio Sironi wrote a great article about “How to be a worse programmer?” A must read!

Silverlight 5: Microsoft’s answer on the Silverlight is dead discussion

The last few weeks, there was a lot of buzz around the future of Silverlight. Although there were some official comments , the rumors kept going. For the remaining skeptics,  what can be a better answer than the announcement of Silverlight 5. A t the Silverlight FireStarter event Microsoft announced the timeline for Silverlight 5 in 2011.  Silverlight 5 was the main subject of  Scott Guthrie’s keynote where Microsoft demoed many of the coming new features and capabilities.  Silverlight 5 will be in beta the first half of 2011 and ship early in the second half of 2011. Some of the impressive improvements(note especially XAML debugging): Silverlight 5 Media improvements: Hardware Decode & Presentation of H.264 performance improvements using GPU support Trickplay with fast-forward and rewind support w/normal audio pitch Improved power awareness Remote-control support Digital Rights Management advancements Application Development improvements: Smoot

Hostname can't support more than 1 level subdomain.

Last week I wanted to test some new Windows Azure Servicebus functionality. So I started by creating a simple WCF service to host on the cloud. After configuring my service settings in the web.config, I started the service and was confronted with the following error message: Hostname can't support more than 1 level subdomain. It took me some time to figure out the root cause of the problem. I had created a namespace on . After checking with Fiddler what was going on I realized that although I was using the appfabriclabs environment, the authentication was still passing on to with the error message above as a consequence. After creating a service namespace through . the application ran successfully.

Using XML namespaces in WPF

When referencing controls from another assembly in XAML, you probably use the xmlns:myAlias="clr-namespace:MyNamespace;assembly=MyAssembly" syntax. Last week I discovered you also have another option, you can use an Uri instead of a namespace reference thanks to the XmlnsDefinition attribute. (Read more about this attribute on MSDN ). It allows you to map a XAML namespace to one ore more assembly namespaces. So how do you use it? Open the AssemblyInfo.cs file under the Properties folder of your project. Add the following line for each namespace in your assembly you want to map: 1: [assembly: AssemblyTitle( "WPF Namespace Sample" )] 2: [assembly: AssemblyDescription( "" )] 3: [assembly: AssemblyConfiguration( "" )] 4: [assembly: AssemblyCompany( "" )] 5: [assembly: AssemblyProduct( "WPF Namespace Sample" )] 6: [assembly: AssemblyCopyright( "Copyright © 2010" )] 7: [assembly: AssemblyTra

Build times for TFS Team Build

After creating an application to monitor builds over multiple Team Projects ,  the customer came back with a second request. As they had the feeling that some builds took a long time to complete they asked us to update the application to include build timings. A colleague took my application and extended it with some extra code. Full code below: 1: class Program 2: { 3: static void Main( string [] args) 4: { 5: // The url to the tfs server 6: Uri tfsUri = new Uri( "<TFS URL>" ); 7: TfsTeamProjectCollection tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(tfsUri); 8: IBuildServer bs = tfs.GetService<IBuildServer>(); 9: WriteQueuedBuilds(bs); 10: Console.ReadLine(); 11: } 12:   13: private static void WriteQueuedBuilds(IBuildServer bs) 14: { 15: IQueuedBuildSpec qbSpec; 16: IQueuedBuildQueryResult qbResults; 17: qbSpec

Windows Azure Platform 30 Day Pass

Microsoft launched a new offer to get started with Windows Azure: the   Windows Azure platform 30 day pass. Great news is that no credit card  is required . The only thing you need to do is click on the following link and use the Promo Code to get going: Use this Promo Code : DPWE01 Sign Up By Clicking This Link : The Windows Azure platform 30 day pass includes the following resources: Windows Azure 4 small compute instances 3GB of storage 250,000 storage transactions SQL Azure Two 1GB Web Edition database AppFabric 100,000 Access Control transactions 2 Service Bus connections Data Transfers (per region) 3 GB in 3 GB out Have a cloudy day!

Visual Studio 2010 SP1 Beta released

Last week Microsoft released a BETA   version of Visual Studio 2010 Service Pack 1. Although a lot of blog posts mentioned the fact that the beta was released, I didn’t find a lot of information about the exact content and features that will be released in Service pack 1. So here is an aggregation of some blog posts which together give you a full overview of all the goodness that’s coming: General overview: Testing features: HTML 5 support, IIS Express, SQL Compact 4, IntelliTrace for 64bit,…:

Great Windows Phone 7 productivity story

As a .NET developer by day, choosing for a Windows Phone seems more obvious than choosing an IPhone or Android phone. However if you don’t use Microsoft products every day, the choice is a lot harder. So if you are a developer planning to create applications on one of the mobile platforms, certainly read this great story comparing development productivity between iOS, Android, WP7 and mobile Web: Definitely a great proof of the power of the Windows Phone 7 development experience!

New Visual Studio 2010/ TFS 2010 VPC’s available

Most of the time if I have to do a demo about Team Foundation Server I use our own TFS (Test) environment. However some clients want to see some specific functionality or don’t have Internet access available for me. In that case I fall back to the standard TFS 2010 demo VPC’s that Microsoft provides us. Last week Microsoft released a new version of these VPC’s. This new version contains the latest feature packs, power tools, and Windows Updates. This refreshed VM will stop working on June 1, 2011 . What’s new in this version? Visual Studio 2010 Feature Pack 2 Team Foundation Server 2010 Power Tools (September 2010 Release) Visual Studio 2010 Productivity Power Tools · Test Scribe for Microsoft Test Manager Visual Studio Scrum 1.0 Process Template All Windows Updates through December 8, 2010 Lab Management GDR (KB983578) Visual Studio 2010 Feature Pack 2 pre-requisite hotfix (KB2403277) Microsoft Test Manager hotfix (KB2387011) Minor fit-and-fini

Prevent hanging build from blocking your TFS build server

Last week I had a question from a customer who complained that all builds on their build server blocked because of one build that sometimes fails. Now the reason why this build failed is something for another blog post. In this post I’ll focus on the way how to prevent that a hanging build keeps blocking your build server. If you open up your build definition, go to the Process tab and expand the Advanced node, you’ll find the Agent Settings node. If you further expand this node you see that you can  specify the following parameters: Maximum Execution Time Type a time span value in hh:mm:ss format. For example, the build will fail with a time-out error if you specify a value of 04:30:15 and the build agent has not completed its work after 4 hours, 30 minutes, and 15 seconds. Specify a value of 00:00:00 if you want to give the build agent unlimited time to process the build. (By default this value is 00:00:00 and this i

Saving NHibernate objects with assigned id’s

One of the great features of Nhibernate is that it manages persistance for us. You just attach an object to the session and NHibernate will figure out if this object is added or changed. But how does NHibernate knows the difference between a new and existing object? By default it uses the value we assigned to the unsaved-value attribute on the id mapping. This means that if the id of our object is equal to our unsaved-value that NHibernate will detect this object as new and do an INSERT statement. If the id value is different from our unsaved-value NHibernate will generate an UPDATE statement instead.   1: < hibernate-mapping default-cascade ="none" xmlns ="urn:nhibernate-mapping-2.2" > 2: < class name ="Test.Data.Domain.Category, Test.Data" table ="Categories" lazy ="true" > 3: < id name ="CategoryID" type ="System.Int32" column ="CategoryID" unsaved-value ="

Impress your colleagues with your knowledge about…the volatile keyword

Sometimes when working with C# you discover some hidden gems. Some of them very useful, other ones a little bit harder to find a good way to benefit from their functionality. One of those hidden gems that I discovered some time ago is the volatile keyword. The volatile keyword indicates that a field might be modified by multiple threads that are executing at the same time. Fields that are declared volatile are not subject to compiler optimizations that assume access by a single thread. This ensures that the most up-to-date value is present in the field at all times. The volatile modifier is usually used for a field that is accessed by multiple threads without using the lock statement to serialize access. The following example demonstrates how an auxiliary or worker thread can be created and used to perform processing in parallel with that of the primary thread.   1: using System; 2: using System.Threading; 3:   4: public class Worker 5: { 6: // This me

Software can not be manufactured

As developers we all agree with the title of this post. Still, a lot of desperate managers and business owners keep pretending that software development is a manufacturing process at heart. Requirements specifications are created by analysts, architects turn these specifications into a high-level technical vision. Designers fill out the architecture with detailed design documentation, which is handed to robot-like coders, who sleepily type in the design’s implementation. Finally, the quality inspector  receives the completed code, which doesn’t receive her stamp of approval unless it meets the original specifications. This sounds an awful lot like the typical waterfall methodology if you ask me! It is no wonder that managers want software development to be like manufacturing. Managers understand how to make manufacturing work, we all do. We have decades of experience in how to build physical objects efficiently and accurately. So, applying what we’ve learned from manufacturing,

Deleting Team Foundation Server Team Projects

If you want to remove a team project from Team Foundation Server when the project is no longer required, you can use the TFSDeleteProject command line tool. This tool can also be used if there are components that remain undeleted after an unsuccessful team project creation. TFSDeleteproject [/q] [/force] [/excludewss] /collection:URL TeamProjectName You can find the TFSDeleteProject command-line tool in Drive:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE on any client computer that runs Team Explorer. Remark: TFSDeleteProject permanently destroys the team project, after which it cannot be recovered. You should backup all important project data before using TFSDeleteProject .

31 days of Windows Phone

Interested in the Windows Phone 7? But you don’t know where to start? First download the free Windows Phone 7 developer tools . The following is installed with the download: Visual Studio 2010 Express for Windows Phone – Free edition of VS 2010 for Phone development. Express Blend 4 for Windows Phone – Free version of Blend for Windows Phone 7 Development. Silverlight for Windows Phone 7 – Rich framework for building great applications for Windows Phone 7. XNA Game Studio for Windows Phone 7 – Rich framework that enables you to build great 2D and 3D games for Windows Phone 7. Windows Phone Emulator – A hardware accelerated emulator that allows you to run and debug your applications and games without requiring a phone. Phone Registration Tool – When you get a device, this allows you to “unlock” the device so you can run/debug your application on it, using your Marketplace account . Afterwards read the 31 Days of Windows Phone 7 blog series by Jeff Blan

NHibernate 3.0 GA released

The GA(General Availability=Final) version of NHibernate 3.0 got released yesterday. Go get it! Most important improvements are the ability to use lambda expressions and a full-blown LINQ provider. Plans for version 3.1 include additional bug fixes and patches, as well as enhancements for the new LINQ provider.

Free e-books for .NET programmers

“There is not such a thing as a free lunch.” Most of the time this is true, but sometimes you find a lot of information for free! I noticed this blog post by Anoop Madhusdanan where he mentions 7 freely available e-books for .NET programmers and architects. If you need a (cheap) gift under the Christmas tree, you’ve find it :-)

Visual Studio 2010 Extensions: Colored Console Application Template

With the release of Visual Studio 2010, creating and finding extensions became a lot easier thanks to the build in Extension Manager. One of the great extensions I discovered is the Colored Console Application Template . Creating a Console application in Visual Studio was always easy. But the standard Console Application project is rather … empty. The moment you needed a mature console application, you probably started adding features like: Functional style command line parser Console Coloring Help With the Colored Console Application Template you no longer have to add these features yourself. You’ll get them out of the box for free including a lot of other features. You can download the template directly from Visual Studio through the Extension Manager or go here and install it yourself.

Error adding test case, there is no test with specified id.

Last week I was testing the Coded UI Test feature of Visual Studio 2010. But when I ran the test in an lab management virtual environment, the test returned an error. In the error log I found the following error message: Error adding test case [xx] to test run: There is no test with specified Id {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}. I found out that the error was caused by the fact that I was running the test against a build that didn’t contain the coded UI Test associated with the Test case.  The problem was that I scheduled a new test run in the Microsoft Test manager without changing the build. To solve the error I queued a build, verified that the build succeeded, then changed the build associated with the test plan. So be sure that your test plan is always up to date with the correct build.

Visual Studio 2010 Feature Pack 2

Visual Studio 2010 Feature Pack 2 is now available to MSDN subscribers. This introduces some new testing features inside Visual Studio 2010: Use Microsoft Test Manager to capture and playback action recordings for Silverlight 4 applications. Create coded UI tests for Silverlight 4 applications with Visual Studio 2010 Premium or Visual Studio 2010 Ultimate.. Edit coded UI tests using a graphical editor with Visual Studio 2010 Premium or Visual Studio 2010 Ultimate. Use action recordings to fast forward through manual tests that need to support Mozilla Firefox 3.5 and 3.6. Run coded UI tests for web applications using Mozilla Firefox 3.5 and 3.6 with Microsoft Visual Studio 2010 Premium or Visual Studio 2010 Ultimate. For more details, see Microsoft also created some videos on the new Testing features in Visual Studio 2010 Feature Pack 2: Coded UI Test for a Silverlight Application Features of Coded UI Test

Check-in Policy override feature

In Team Foundation Server, you have the concept of check-in policies. This feature allows you to define a set of checks that have to succeed before a developer can check-in it’s code. But a developer can always override these check-in policies and still do a check-in. A lot of customers ask if they can block the user from overriding the policy. To state it clear: you cannot disable this feature. However you can get alerts when someone overrides the policies: Click Team --> Alerts Explorer. Add a CheckinEvent. Set Alert Definition to PolicyOverrideComment<>''

Debugging SQL with SQL Management Studio

I think we all agree that testing stored procedures and functions on a database tier can be time consuming, they are hard to debug and sometimes just difficult to get clarity on what is “happening”.  To help you understand what’s going on, you can use the built-in debugging features of Microsoft SQL Management Studio. These allow you to see exactly what is going on, and step through your logic in a similar fashion as in Visual Studio. To get you going check this post( Debugging SQL Queries, Functions, & Stored Procedures with SQL Management Studio’s Integrated Debugger ) by Doug Rathbone.