Thursday, March 31, 2016

TFS 2015 Programmability–Breaking change in Update 1

A warning for everyone who has planned to upgrade to TFS 2015 Update 1(or later)…

If you created server-side plugins for TFS and specifically are using the Microsoft.TeamFoundation.Framework.Server.ISubscriber interface, be aware that Update 1 includes a breaking change in that interface, meaning that all server-side plugins compiled against TFS 2015 will need to be modified in order to work with TFS 2015 Update 1 servers.

The table below outlines the set of impacted classes and interfaces:

Old Reference New Reference
TeamFoundationRequestContext IVssRequestContext
TeamFoundationServiceHost IVssServiceHost
ITeamFoundationService IVssFrameworkService
DeploymentServiceHost IVssDeploymentServiceHost

More information here:

Friday, March 25, 2016

TFS Build Error: Invalid expression term '.'

A colleague passed by my desk yesterday with the following question:

We recently moved to Visual Studio 2015 and started to use some of the new C# language features in .NET 4.6, like for example Null Conditional operators. However after doing that our CI build started to fail on the Build server. What I’m doing wrong? Or are there some components missing on the build server?

When I took a look at the failing build I saw the following error messages:

Handlers\DocumentMestbankLoketHandler.cs (42, 0)

Invalid expression term '.'

Handlers\DocumentMestbankLoketHandler.cs (42, 0)

Syntax error, ':' expected

Handlers\DocumentMestbankLoketHandler.cs (42, 0)

; expected

Handlers\DocumentMestbankLoketHandler.cs (42, 0)

Invalid expression term ')'

Handlers\DocumentMestbankLoketHandler.cs (42, 0)

; expected​

I started by checking the build server if .NET 4.6 and the Build tools for Visual Studio 2015 were installed. Both were available…so that was not causing the problem.

I opened up the build definition itself and noticed that an old Build Process template was used(DefaultTemplate.11.1.xaml). This old template doesn’t want to use the latest MSBuild version(for a reason I don’t understand).


We switched to the newer TFSVC build template(TfvcTemplate.12.xaml.) reconfigured all the settings and the build was all green again!


Thursday, March 24, 2016

CQRS+Event Sourcing Blog series

As I’m working on a project where are using Event Sourcing, I try to read all material I can find about the topic. One great resource is the blog series by William Verdolini about CQRS + Event Sourcing.

An overview of the content:

  1. Intro
  2. CQRS+ES Architecture
  3. Inversion of Control
  4. Validation Logic
  5. Event Store
  6. Async matters

Don’t forget to have a look at the associated code as well:

Wednesday, March 23, 2016

Generate your API documentation with DocFX

After using Sandcastle for years as my default code documentation tool, I’m happy that I can finally leave Sandcastle behind and switch to a better tool; DocFX.


From the documentation

DocFX is an API documentation generator for .NET, currently it supports C# and VB. It has the ability to generate API reference documentation from triple slash comments of your source code. What's more, it allows you to use markdown files to create additional topics like tutorials, how-tos, or even customize the generated reference documentation. DocFX builds a static HTML web site from your source code and markdown files, which can be easily hosted on any web servers, for example, DocFX also provides you the flexibility to customize the layout and style of your web site through templates. If you are interested in creating your own web site with your own styles, you can follow how to create custom template to create custom templates.

DocFX also has the following cool features:

  • Integrated with your source code. You can click "View Source" on an API to navigate to the source code in GitHub (your source code must be pushed to GitHub).
  • Cross platform. We have both exe version that runs under Windows and a DNX version that runs cross platform.
  • Integrated with Visual Studio. DocFX can be used within Visual Studio seamlessly.
  • Markdown extensions. DocFX Flavored Markdown(DFM) is introduced to help you write API documentation. DFM is 100% compatible with Github Flavored Markdown(GFM) with some useful extensions, like file inclusion, code snippet, cross reference, and yaml header. For detailed description about DFM, please refer to DFM.

How to use it?

  • Start by downloading the DocFX executable and adding the install location to your PATH environment variable.
  • Open a command prompt and browse to the directory where you want to store the documentation
    • Call docfx init –q to generate the documentation project and configuration file


  • Open the docfx.json and configure the json documentation file where to search for source code(default is src subfolder).


  • Build the project website
    • docfx docfx_project/docfx.json



Tuesday, March 22, 2016

fsharpConf 2016–Videos

In case you missed it, March started great with a first edition of fsharpConf, a free virtual event featuring world-class F# experts across the globe. It showcases F# in action on a wide range of practical applications.


Luckily all sessions are recorded and available on Channel 9. If you are an F# developer or are interested in becoming one, go check it out…

Monday, March 21, 2016

Team Foundation Server: How to migrate TFS Version Control project by project–Part 2

If you want to migrate a full TFS collection, support is built-in. But what if you want to migrate a specific project but want to keep the source code history?

I blogged about a solution I used before by using Git as a way to move code between 2 TFS Version Control repositories. (Here is the link in case you cannot find it: I used this approach multiple teams with great success.

However some people who tried to do the same thing complained that the approach I described didn’t work when you have multiple branches. So time to solve this and add the misssing steps required to migratie multiple branches:


repositoryformatversion = 0

filemode = false

bare = false

logallrefupdates = true

symlinks = false

ignorecase = true

hideDotFiles = dotGitOnly

autocrlf = false


ignore-branches = False


touch = 1

[tfs-remote "default"]

url = http://oldtfs:8080/tfs/DefaultCollection

repository = $/BranchingDemo/Main

[tfs-remote "Development/Feature1"]

url = http://oldtfs:8080/tfs/DefaultCollection

repository = $/BranchingDemo/Development/Feature1

[tfs-remote "Development/Feature2"]

url = https://oldtfs:8080/tfs/DefaultCollection

repository = $/BranchingDemo/Development/Feature2

[tfs-remote "Releases/Release1"]

url = http://oldtfs:8080/tfs/DefaultCollection

repository = $/BranchingDemo/Releases/Release 1

[tfs-remote "BranchingDemo"]

url = http://newtfs:8080/tfs/DefaultCollection

repository = $/NewRepository/DevFeature1

  • Initialize the remote
    • git-tfs branch –i BranchingDemo
    • This disconnects the branch from the current remote and connect it to the new TFS server
  • Switch between all branches and execute the following commands:
    • ​git checkout "branchname"
    • git tfs branch $/TargetProject/TargetBranch --comment="branch X" 

Friday, March 18, 2016

InfoQ–Why Agile Works mini book

A great read I can recommend for everyone interested in the Agile (r)evolution. It really focusses on the core concepts behind Agile and how to evolve from ‘doing Agile’ to ‘being Agile’. 


From the website:

Why do some companies excel with agile and others see virtually no improvement? The difference is culture and an understanding that agile is a framework for deep cultural change instead of a process or set of practices to increase efficiency.

Processes and methods can become stale and rote, and can stifle innovation—even processes that were initially developed to be agile. An agile culture, however, will continuously improve and adapt without the need for periodic change initiatives.

Why Agile Works: The Values Behind the Results focuses on why and how agile works and where agile should take organizations in terms of values. Here you’ll learn:

  • - Why agile fails most often
  • - How culture determines results
  • - The difference between values and beliefs
  • - A framework for describing agile organizational values 
  • - How to recognize common beliefs that support and undermine an agile organization

If agile is a framework for change, this book is about what this change looks like and how agile beliefs lead you there.

Download the book here:

Thursday, March 17, 2016

NEventStore PollingClient does nothing

For my next project we’ll use Event Sourcing. Therefore I’m spending some free time in looking at NEventStore, a persistence agnostic Event Store for .NET.

One of the features of NEventStore is a built-in PollingClient allowing you to poll the Event Store for the latest commits. However when I tried to test the PollingClient nothing happened?!

Here is the code I was using:

No exception was thrown, however when I browsed through the Output window in Visual Studio I noticed the following message:

A first chance exception of type 'Newtonsoft.Json.JsonSerializationException' occurred in NEventStore.dll

It seems that the PollingClient immediatelly tries to deserialize the committed events, as I didn’t include a reference to the assembly containing the Events, the deserializer (silently) fails.

To fix it, the only thing I had to do was adding a reference to my Events assembly.

Wednesday, March 16, 2016

ASP.NET RedisSessionStateProvider - ERR unknown command 'EVAL'

After switching to the RedisSessionStateProvider  our ASP.NET application started to fail with the following error message:

ERR unknown command 'EVAL'

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: StackExchange.Redis.RedisServerException: ERR unknown command 'EVAL'


On StackOverflow I found that it could be related to an older Redis version as the EVAL command was introduced in Redis 2.6.

A quick check using the INFO command revealed that I was indeed using an older version:


After upgrading to a more recent version, the error went away!

Tuesday, March 15, 2016

Angular 1.5 - Stateless components

Angular 1.5 brings us ‘Components’, a special kind of directive that uses a simpler configuration. It is a first step towards Angular 2.0 where directives and controllers no longer exist and are replaced by a component-based model.

Advantages and disadvantages of components

From the Angular documentation:

Advantages of Components:

  • simpler configuration than plain directives
  • promote sane defaults and best practices
  • optimized for component-based architecture
  • writing component directives will make it easier to upgrade to Angular 2

When not to use Components:

  • for directives that rely on DOM manipulation, adding event listeners etc, because the compile and link functions are unavailable
  • when you need advanced directive definition options like priority, terminal, multi-element
  • when you want a directive that is triggered by an attribute or CSS class, rather than an element

Most important to remember is that components have their own isolated state(meaning that only isolated scope is supported) and that no DOM interactions are possible.

An example

I created a small ‘PreviousNext directive’ that enable/disable previous/next buttons in a wizard. This directive uses state on a higher level wizardcontroller.

Here is the original code:

I decided to rewrite this directive to a component but to keep things simple I left most of the state in the wizardcontroller.

Here is the code rewritten as a component:

Let’s have a look at the main differences:

  • We didn’t specify a controller meaning that Angular creates one for us behind the scenes. It also creates a controllerAs value for us, $ctrl by default. So the $ctrl calls inside the template are calling a generated controller available through the $ctrl alias.
  • We used bindings to control the inputs and outputs of our component. Inputs are bound with the ‘<’  symbol and indicates a one-way binding. Output are bound with the ‘&’ symbol and function as callbacks to events. So we read out the currentStep value, call onNext, onPrevious and isLastStep functions on our generated controller that are routed to functions on the parent  (wizard)controller.

I could further improve this component by moving all the previous/next logic inside the component and call a function to feed the currentStep back to the wizardController. But this is an exercise I leave up to the reader… Smile

Monday, March 14, 2016

Hidden Azure Job offering

Fun fact;  when opening the Azure portal you get some nice ASCII art inside the debug console of your favorite browser and it even includes a job offering Smile.


Friday, March 11, 2016

WIF: Enable tracing

WIF(Windows Identity Foundation) is not the most easy framework to use. The moment something goes wrong it’s not always transparent what actually happened leaving you no clue where to search for the root cause.

Luckily Microsoft integrated great tracing functionality so you can have a look under the hood. To enable tracing, add the following configuration to your app.config/web.config file:

Tracing information will be written to a file in XML format. However you can use the SVCTraceViewer tool to open and read the trace messages in a more user-friendly format.


Thursday, March 10, 2016

Converting MS Access Reports to SQL Server Reporting Services Reports

I learned a neat trick from one of my colleagues today, something I wasn’t aware that it was even possible.

Did you know that you can take an existing MS Access report and convert it to a SQL Server Reporting Services(SSRS) report? Me neither! And it fact, it’s quiet easy. Let me show it…

  • Create a new SSRS project using the SQL Server Data Tools for BI(SSDT).


  • Click on the PROJECT menu item, choose Import Reports and click on the Microsoft Access… menu item.


  • Select the Access application you want to load the reports from and click OK.


  • That’s it!

Remark: Note that it is still possible you have to fix some errors after the import because not all Microsoft Access Report features are supported in SSRS.

Wednesday, March 9, 2016

CQRS with decoupled messaging series

Rishabh S Ajmera wrote a blog series about implementing a CQRS architecture with emphasis on decoupling messaging. Definitely worth checking out!

A quick overview:

  1. Introduction
    • Current article explaining the principles being followed.
  2. Need for Enterprise Servicebus Frameworks and Decoupled messaging with their samples
    • We will look at samples from MassTransit and nServicebus documentation and will decouple publish subscribe from those samples.
  3. Inventory Manager - CQRS application (with decoupled messaging) - Commands
    • Inventory Manager application will be introduced. It is implementation of Greg Young's Simple CQRS Example, however making it usable for real world. Currently Inventory Manager application implements only first usecase of creating an inventory item.
    • The post will focus on sending command following CQRS architecture in Inventory Manager application.
  4. Inventory Manager - CQRS application (with decoupled messaging) - Aggregate and Event Sourcing
    • Explaining the workings of Aggregate and Event Sourcing in Inventory Manager application
    • Focuses on how to ensure publishing of events upon saving of aggregate (without Distributed Transaction)
  5. Inventory Manager - CQRS application (with decoupled messaging) - ReadSide
    • Thin Read layer in Inventory Manager and points of interest about implementing it

Tuesday, March 8, 2016

Enabling CORS in ASP.NET Web API

When testing some code I noticed that a specific AJAX call kept returning a 405 Method not allowed response. Although I was calling $.ajax({type: "POST"}) behind the scenes the browser changed the request to an OPTIONS request.

What was going on? What I didn’t notice at first sight was that the AJAX request was send to another domain, meaning I’m making a cross-origin HTTP request. For security reasons, browsers restrict cross-origin HTTP requests initiated from within scripts. Before you can do a cross-origin request, the browser will initiate a preflight CORS(Cross-Origin Resource Sharing) check. This explains the OPTION request going out.

It is up to the called API to handle this preflight check and return headers describing what’s allowed and not.

Permission/Feature Request Header Response Header
Origin Origin Access-Control-Allow-Origin
HTTP method Access-Control-Request-Method Access-Control-Allow-Method
Request headers Access-Control-Request-Headers Access-Control-Allow-Headers
Response headers   Access-Control-Expose-Headers
Credentials   Access-Control-Allow-Credentials
Cache preflight response   Access-Control-Max-Age

Enabling this for an ASP.NET Web API is easy:

  • Download and install the Microsoft.ASPNET Web API CORS NuGet package:
    • Install-Package Microsoft.AspNet.WebApi.Cors
  • Add the following code to your WebApiConfig.Register method:
  • This is all you need to do.
    • Remark: In this case I globally enabled CORS support, but it is also possible to do this for a specific controller

Monday, March 7, 2016

Error loading web project: The URL is configured to use IIS Express as the web server but the URL is currently configured on the local IIS web server.

Today I tried to do a code review but when I tried to load the solution in Visual Studio, it failed with the following error message:

The URL is configured to use IIS Express as the web server but the URL is currently configured on the local IIS web server. To open this project, you must use IIS Manager to remove the bindings using this URL from the local IIS web server.


I wanted to use IIS to host this web project, so I had to find out why it was trying to use IIS Express…

Inside my csproj file everything looked correct:

Strange! However there is also a csproj.user file and indeed  there the UseIISExpress settting was enabled:

After changing this to false, I was able to load the web project and start my review.

Friday, March 4, 2016

Applying Scrum in your enterprise–Shu Ha Ri

As a consultant I spend a lot of time at different companies, giving me the opportunity to compare used practices, methodologies and tools. One of the things I noticed is that Agile has hit mainstream and is now applied almost everywhere. Most of the time, this means that companies are using Scrum or a derivative ScrumBut, WaterScrumFall,…

However, most companies make the same mistakes:

  • Focussing too much on the Scrum ceremonies(Daily Scrum, Sprint Retrospective,…) without understanding the reasoning behind it
  • Picking a subset of the Scrum concepts and ceremonies before first applying Scrum “from the book”, adapting the rules without knowing the importance of these rules

Let’s use some Japanese wisdom and apply the Shu Ha Ri model of learning:


This model shows the different stages that learners go through when learning new concepts:

  • Shu—Follow rules to learn basics
  • Ha—Break rules and discover context
  • Ri—Mastery and find your own way

If we apply this to Scrum inside your enterprise:

  • Shu – Apply Scrum as defined without changing or adapting any of the meetings or rules
  • Ha – Start experimenting, measure impact and learn from your mistakes
  • Ri – Find an Agile way of working that suits your needs

Thursday, March 3, 2016

OWASP WebGoat and Security Shepherd Projects

If you are new to (web application)security or want to extend your knowledge, the guys from OWASP created 2 great projects to get you started:


OWASP WebGoat Project

From the website:

WebGoat is a deliberately insecure web application maintained by OWASP designed to teach web application security lessons. You can install and practice with WebGoat. There are other 'goats' such as WebGoat for .Net. In each lesson, users must demonstrate their understanding of a security issue by exploiting a real vulnerability in the WebGoat applications. For example, in one of the lessons the user must use SQL injection to steal fake credit card numbers. The application aims to provide a realistic teaching environment, providing users with hints and code to further explain the lesson.


OWASP Security Shepherd

From the website:

The OWASP Security Shepherd project is a web and mobile application security training platform. Security Shepherd has been designed to foster and improve security awareness among a varied skill-set demographic. The aim of this project is to take AppSec novices or experienced engineers and sharpen their penetration testing skillset to security expert status.


Wednesday, March 2, 2016

Front-end development Handbook

If you are new to front-end web development and have no clue where to start, I can recommend the Front-end Handbook written by Cody Lindley. The book briefly discusses all the topics relevant for front-end development, what’s important and what not and links to a large set of resources to help you grasp and understand each of these topics in more detail.


It is the perfect learning path to help you getting started with front-end web development.

More information:

Tuesday, March 1, 2016

Templates for Windows 10 Universal Apps

To speed up the creation of a Windows 10 Universal App, Intense created a set of free templates to get you started.


From the site:

Controls, templates, and tools for building Universal Windows Platform apps on Windows 10. The Intense toolkit consists of two parts; a library of controls and helpers distributed as NuGet package, and a Visual Studio extension with project templates for creating new UWP apps.

Intense Templates

Adds new project and item templates to Visual Studio 2015 for creating Universal Windows apps. The templates are available in both C# and Visual Basic flavors.

You can download the required Visual Extension from the Visual Studio Gallery: