Wednesday, December 24, 2014

Microsoft Threat Modeling Tool

Security is a hot topic today(certainly with the recent Sony hack). Integrating security into an application cannot be an afterthought but should be an integrated part of the software development lifecycle. One approach to tackle this problem is the Security Development Lifecycle as adopted by Microsoft:

The Security Development Lifecycle (SDL) is a software development process that helps developers build more secure software and address security compliance requirements while reducing development cost.

Threat modeling is an invaluable part of the Security Development Lifecycle (SDL) process. By applying a structured approach to threat scenarios during the design phase of development helps teams more effectively and less expensively identify security vulnerabilities, determine risks from those threats, and establish appropriate mitigations. One tool to help you do this is – Microsoft Threat Modeling Tool 2014. It’s available as a free download from Microsoft Download Center here.

Microsoft Threat Modeling Tool 2014 comes with a base set of threat definitions using STRIDE categories. This set includes only suggested threat definitions and mitigations which are automatically generated to show potential security vulnerabilities for your data flow diagram. You should analyze your threat model with your team to ensure you have addressed all potential security pitfalls. To offer more flexibility, Microsoft Threat Modeling Tool 2014 gives users the option to add their own threats related to their specific domain.


More information:

Tuesday, December 23, 2014

Visual Studio 2013–SQL Server Data Tools error: SQL71501: User: [user] has an unresolved reference to Login [user]

After importing a database using the SQL Server Data Tools in Visual Studio, I got a compilation error on my database project:

SQL71501: User: [user] has an unresolved reference to Login [user]

The SQL Server Data Tools by default only import the database specific objects. A database login, which is a global database server object, is not imported. This explains the error. But how can we fix this?

In previous versions of the SQL Server Data Tools, you had 2 types of Database Projects; the normal Database Project and also a Database Server project. However in VS 2013, the Database Server project no longer exists. So we need a different solution.

I first tried to solve it using Schema Compare.  I clicked on the 'Options' button in the Schema Compare window and selected the "Object Types" tab. There I choose to include logins. But when I ran the Schema Compare, it didn’t made any difference.  I probably did something wrong, but as I was short on time, I took a different approach. I added a Login object myself and copied the script code over:

CREATE LOGIN [user] WITH PASSWORD = 'myverycomplexpassword'


Monday, December 22, 2014

LabManager VMM Server Background Synchronization Job Failing

The Team Foundation Server logs of a client was filling up with errors about a failing job: LabManager VMM Server Background Synchronization. This runs every few minutes and tries to keep the LabManager server up to date.


The reason why this job fails on our system is because the Lab Management functionality is no longer in use. We used it when we were still on Team Foundation Server 2012. But when we moved to Team Foundation Server 2013, we didn’t upgrade the Lab Management part as well. So the Lab Management parts were gone and we didn’t de-register it first.

I wanted to get rid of these errors and decided to look for a solution.

First thing I tried was using the tfsconfig command and ask TFS to delete the lab management part:

tfsconfig lab /delete /collectionName:<collectionname>


But this failed with a TF255384 error complaining that the Virtual Machine Manager Administration Console could not be found on the application server. I didn’t want to install it again, so I looked for another solution. This blog post mentioned that I could delete the lab management data from the Configuration database. It sounds like a hack, it smells like a hack and it even looks like a hack. But I had a backup of all components, so why not?

I connected the TFS Database Server and executed the SQL script as mentioned in the post:

use Tfs_Configuration;

delete tbl_RegistryItems where ParentPath = '#\Configuration\Application\LabManagementSettings\';

And the great thing is, it worked!

Friday, December 19, 2014

Use Hangfire to schedule jobs in ASP.NET

Hangfire is a great library to schedule and execute asynchronous work in a web application. One of the things I like about this library is that you can start with a simple background process inside the Application Pool and when your jobs get larger(and take more time) you can move them to a separate process.

Here are the steps to move your Hangfire jobs outside your web application:

  • Step 1 – Change the Hangfire configuration inside your web app to disable the Hangfire server functionality(note that the job information is stored inside a database):
  • Step 2 –Schedule your jobs(like you did before):
  • Step 3 – Inside another project, a console application in this case, you can host the Hangfire server:

Thursday, December 18, 2014

Team based vs Project based

As a certified Scrum Master, I do most of my projects using Scrum (or Scrum but…). I really like the transparency and continuous feedback that Scrum brings to the table. But I also notice that Scrum isn’t the perfect fit for all kinds of projects. It’s suited well for Green-Field/Brown-Field projects but I struggle applying Scrum to a Maintenance project or where one team is working on multiple projects at the same time(which is not done in Scrum).

After reading the following article – No projects, Beyond projects – I stopped trying to use Scrum as the hammer that works for every nail(and screw). In this article, the author promotes an alternative model to think about work. He calls this the Beyond Projects model or more descriptive Continuous Work, or Steady State Work Model, or Work Streams.

The author doesn’t mention it, but it sounds familiar to Kanban

Wednesday, December 17, 2014

Angular.js 1.3: bindToController

I keep finding new stuff inside Angular 1.3. One of the things I found is the bindToController attribute. I’m an advocate of using the controllerAs syntax to get rid of the $scope variable. The only problem before is that in a directive you still had to use $scope…until now.

Let’s first have a look at what the AngularJS documentation has to say about the bindToController attribute:

When an isolate scope is used for a component (see above), and controllerAs is used, bindToController: true will allow a component to have its properties bound to the controller, rather than to scope. When the controller is instantiated, the initial values of the isolate scope bindings are already available

Before scope variables were not included in the controller scope when controllerAs was used. This means that the directive's scope variables were not bound to the object created by controllerAs.  The bindToController attribute fixes this.

Enough talk, show me the code:

Tuesday, December 16, 2014

Woops! Angular suddenly stopped working… and it was Batarangs fault

Last week I encountered a strange problem. Without changing anything to my code, my Angular application started failing. I had no clue why… until I noticed that Batarang, a Chrome Extension for Angular.Js had been updated. It looked completely different and injected some custom JavaScript into my application. As far as I could remember, it did not do that before.

Could it be? I disabled the extension in Chrome and yes, my Angular.js application started to work again. Verwarde emoticon Anyone who had the same problem with the latest AngularJS Batarang extension?

Note: I’m using Angular 1.3 but a colleague had the same issue with Angular 1.2


Monday, December 15, 2014

WPF Performance Tips

With the recent announcements about new WPF features, it’s time to re-introduce some WPF related blog posts.

When browsing through the CodeProject articles, I noticed this great post about WPF performance:

This is one of the most complete performance guides I’ve ever seen and certainly useful for every WPF (and even XAML) developer.

Here is the list of topics covered:

  • Basic knowledges of WPF rendering.
    • Pixel Snapping in WPF Application
    • WPF Visual Rendering
  • Detect issues with WPF performance suite - Performance Profiling Tools for WPF
    • Detect Software Render
    • Detect Undesired Rendering
  • Make a trade-off between graphique's quality and performance.
    • Disable Pixel Snapping and Anti-Aliased option
    • RenderOption
    • UIElement.CacheMode and BitmapCache
  • Make a trade-off between architecture and performance
    • IValueConverter and IMultiValueConverter
  • Improving scrolling performance in WPF (Virtualization)
  • WPF in remote desktop
  • Third party libarary
  • The Roadmap for WPF (published at 12 Nov 2014 by Microsoft Project Manager)
  • Brief and Conclusion
  • References

Go bookmark this link!

Friday, December 12, 2014

Microsoft Azure–A/B testing

A/B testing is a technique whereby different users get a different version of an application of website. This allows you test new features ‘in the wild’ and allows to check which experience or functionality is preferred. Facebook uses this technique a lot, but it’s also a useful technique for the ‘non-facebooks’ of the world.

Doing A/B testing in Azure Websites is really easy. It is supported out-of-the-box by using multiple deployment slots. Let’s walk through the steps:

  • Open the Azure Management Portal. Use the new portal available at The A/B testing functionality can only be configured there.
  • Create a new Website. Choose a URL, Web Hosting Plan(Deployment slots are only available when you use a Standard plan), Resource Group, Subscription and Location(or just use the defaults Glimlach). Click on Create.
  • Once the website is created, open the blade of the site and look for the Deployment slots section.


  • Click on Deployment Slots to load the Deployment Slots blade. Click on Add Slot to create a new deployment slot.


  • Specify the name of the slot(this will become part of the URL) and click OK.



  • Click on the Testing in production configuration. The configuration blade is loaded. For every slot, you can specify how much of the traffic is going to one of the slots or the production site. Click Save to apply the changes.


Thursday, December 11, 2014

TypeScript build server error: "tsc.exe" exited with code 1.

typescriptAfter configuring a Continuous Integration build for a TypeScript enabled web application, the build turned red with the following error message:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\TypeScript\Microsoft.TypeScript.targets (118): "tsc.exe" exited with code 1.

On the build server I had installed the TypeScript components for Visual Studio 2013, but for this particular project we were still using Visual Studio 2012. I was able to fix the problem by installing the TypeScript 1.0 Tools for Visual Studio 2012 on the build server.

Wednesday, December 10, 2014

Angular.js templates inside Visual Studio: SideWaffle Template Pack

If you want to save some time when building Angular.js applications, have a look at SideWaffle.

SideWaffle is an extension for Visual Studio. It contains both item- and project templates suitable for building websites, Windows apps, Windows Phone apps, WPF, Visual Studio extensibilty project and a lot more. 


More information can be found at the official website:

Tuesday, December 9, 2014

Angular.js: Use an Angular filter inside your controller

Most of the time you’ll use your Angular filter inside your view, but sometimes it’s useful to use it from inside your controller. To do this, you have to inject the ‘filterFilter’ service:

Monday, December 8, 2014

Azure Websites–Site Extensions

Site Extensions allow to enhance the management experience of Azure Websites. There is already a small set of extensions out there, but nothings stops you from creating your own(you have to create them as NuGet packages).

The list of available extensions can be found at This is also the place where you can upload your own extensions and share them with the rest of the world.


Friday, December 5, 2014

ASP.NET Web API–Return 401 when using OWIN cookie authentication middleware

Wen using the OWIN cookie authentication middleware inside ASP.NET Web API, I noticed that I didn’t got an unauthorized (401) HTTP code when I was not authenticated. Instead the response was a 200 status code with a JSON response body:

{"Message":"Authorization has been denied for this request."}

This is not what I want. To change this you have to reconfigure the CookieAuthenticationProvider on the cookie authentication middleware:

Thursday, December 4, 2014

SpecFlow Assist Helpers

If you are a SpecFlow user certainly check out the Helper classes inside the TechTalk.SpecFlow.Assist namespace.

The helpers offer a wide range of functionality. I use it most of the time to translate the parameter table to a typed object:


More information can be found here:

Wednesday, December 3, 2014

SpecFlow: Visual Studio does not recognize steps in another assembly

On my current project we are using SpecFlow to create our BDD style tests. I really like the experience so far. One of the things that you have to understand when using SpecFlow is that the end goal is a set of re-usable steps that allow you to specify new scenario’s (and tests) fast.


In our case we already have a set of steps that we want to re-use in multiple test projects. Therefore I created a separate assembly where I put some of my shared steps classes.This is a supported scenario inside Specflow, the only thing you need to do is to specify the assembly name inside your app.config:

    <!-- For additional details on SpecFlow configuration options see -->
      <stepAssembly assembly="Tests.SharedSteps" />
    <unitTestProvider name="MsTest" />

However when I opened a SpecFlow feature file that should use one of the shared steps, the steps showed up purple (which means that SpecFlow is unable to find the step).


It took me some time to figure out a solution. Here is how I did it:

  • Close all your .feature documents in Visual Studio.
  • Close Visual Studio.
  • Go to the %TEMP% folder. Delete the SpecFlow cache files.
  • Open Visual Studio again.
  • Open your .feature files again.

That did the trick for me…

Tuesday, December 2, 2014

Use JavaScript to write Macros in Visual Studio

The Visual Studio Platform team released a new extension for Visual Studio 2013; Macros for Visual Studio 2013.

From the documentation:

Macro ExplorerMacros for Visual Studio 2013 is an extension for Visual Studio 2013 that enables the use of macros to automate repetitive tasks in the IDE. The extension can record most of the commands in Visual Studio including text editing operations.


  • Record and playback active document operations and Visual Studio IDE commands
  • Playback multiple times

  • Manage and persist macros with a Macro Explorer

  • Assign keyboard bindings to any macro

  • Macros recorded as JavaScript files that call VS DTE APIs

  • Macro editing in Visual Studio with DTE IntelliSense

  • Stop playback

  • Sample macros

Monday, December 1, 2014

LocalDb error: Cannot attach the file ‘sample.mdf’ as database ‘sample.mdf’

In a demo app I  used the LocalDB functionality to host my database files. This should have saved me some time. However when I ran the application, I ended up with the following error message:

{"Cannot attach the file 'C:\\Projects\\SampleApp\\App_Data\\sample.mdf' as database 'sample'."}

Looking at my connection string data inside my web.config, everything looked fine:

<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=Sample;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\Sample.mdf" providerName="System.Data.SqlClient" />

But when I opened up the App_Data folder, I found an empty folder. Aha! It seems like you have to create the database file yourself. I opened up the solution, right clicked on the App_Data folder and choose Add –> New item…


Friday, November 28, 2014

Angular.js performance tip: Disabling Debug Data

While reading through the Angular.js documentation I stumbled over the following great performance tip:
By default AngularJS attaches information about scopes to DOM nodes, and adds CSS classes to data-bound elements. The information that is not included is:
As a result of ngBind, ngBindHtml or {{...}} interpolations, binding data and CSS class ng-class is attached to the corresponding element.
Where the compiler has created a new scope, the scope and either ng-scope or ng-isolated-scope CSS class are attached to the corresponding element. These scope references can then be accessed via element.scope() and element.isolateScope().
Tools like Protractor and Batarang need this information to run, but you can disable this in production for a significant performance boost with:
myApp.config(['$compileProvider', function ($compileProvider) {
If you wish to debug an application with this information then you should open up a debug console in the browser then call this method directly in this console:
The page should reload and the debug information should now be available.

For more see the docs pages on $compileProvider and angular.reloadWithDebugInfo.
Nice! Glimlach

Thursday, November 27, 2014

Team Foundation Best Practices Analyzer - "%TFSServerURLValidated% error

When running the Team Foundation Best Practices Analyzer, it failed immediately with the following message:

Cannot validate the URL provided The scan was generated using the corrected URL "%TFSServerURLValidated%".


I never seen this issue before. On the Internet I found some related blog posts here and here. But in my case the solution was a lot simpler: I ran the tool again with the ‘Run as Administrator’ option. This time everything was working as expected.

Wednesday, November 26, 2014

Upgrading to Caliburn.Micro 2.0

As Microsoft announced some new WPF features, I found a good excuse to do a WPF blog post Glimlach.

Recently I had to do some changes to an WPF application I built some time ago. While implementing the change, I noticed that a new version of Caliburn.Micro was available. I always loved Caliburn.Micro, it is still one of the best MVVM frameworks out there.

Now doing this upgrade wasn’t that hard but wasn’t a walk in the park either. Here are some of the problems I encountered:

  • Bootstrapper<T> no longer exists. Instead you have to inherit from BootstrapperBase.
  • Inside the Bootstrapper override the OnStartup method and call the DisplayRootViewFor<> method:

protected override void OnStartup(object sender, StartupEventArgs e)


  • EventAggregator.Publish now takes an action to marshal the event. You can still use the EventAggregator.PublishOnUIThread if you want the original behaviour.
  • Message.Attach should be renamed from clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro to clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro.Platfor

Some other breaking changes can be found here:

Tuesday, November 25, 2014

Integrating Google Analytics in your Single Page Application

If you want to learn the ins and outs of the Google Analytics API and understand how to integrate it inside a Single Page Application, try the ‘Poses by Khalil’ tutorial(for anyone wondering, Khalil is a cat).

‘Poses by Khalil’ is is a tutorial single page application (SPA) to show you how to track common interactions using the latest incarnation of Google Analytics, Universal Analytics.


Monday, November 24, 2014

Linq in your browser: underscore.js

While working on an Angular application, I ended in a situation where I had to add another tool in my toolbox: underscore.js. It not only offers over 100 functions that support functional helpers like map, filter, invoke — but also has a fluent API that allows to create LINQ style queries.

An example:

Friday, November 21, 2014

Angular.js ui-router: Focus on view

In an Angular.js application we are building, we use the great ui-router module as a replacement for the default ngRoute module.

From the documentation:

AngularUI Router is a routing framework for AngularJS, which allows you to organize the parts of your interface into a state machine. Unlike the $route service in the Angular ngRoute module, which is organized around URL routes, UI-Router is organized around states, which may optionally have routes, as well as other behavior, attached.

States are bound to named, nested and parallel views, allowing you to powerfully manage your application's interface.

It offers a lot more flexibility than ngRoute and is our default choice when building Angular.js applications.

This doesn’t mean that everything is perfect. Last week we got a bug from a user mentioning that the page scrolled down when loading the Angular.js application. We discovered that this is caused by the ui-route module which has autoscroll enabled by default.

Luckily it’s easy to change this, just add the following attribute to your ui-view location:

<div ui-view autoscroll="false"></div> 

More information about this attribute can be found here:

That’s it!

Thursday, November 20, 2014

Free ebook – Perspectives on Agile Software Testing

In celebration of the 10th anniversary of Selenium, the guys from Thoughtworks created a small ebook available for free:

It's been 10 years since Selenium was born and the industry has changed tremendously since then. In honor of Selenium's first decade, we put together some our greatest hits and new pieces on software testing.

How has testing evolved in the past decade? How do we adapt to the new challenges that mobile testing has to offer? Can testing in an agile environment lead to faster feedback?

Download this free e-book and read more about the big developments in testing methods and tools, while looking closely at the advent of mobile testing and what the future holds for QAs. 

The book can be downloaded here:

Remark: Be aware that you have to register first.


Wednesday, November 19, 2014

Microsoft is going Open Source… for real!

The last years Microsoft is making more and more stuff Open Source. So last week at the Connect() event, it was no surprise when they announced that they have open sourced the .NET Core Runtime and Libraries.

If you still think that Microsoft isn’t serious about this whole Open Source move, have a look at their GitHub landing page and see the whole list of technologies and tools that they are creating in the open:


Tuesday, November 18, 2014

Windows Azure Readiness: Azure Website Migration Assistent

You have an existing web application running on premise and you are interested in moving to Windows Azure? Then go check out In 3 steps this website will guide you through the process to get your website to the cloud.

Step 1. Install MS Open Tech Migration Assistant Tool

This small ClickOnce application should be installed on your local machine. It scans your local or remote IIS server for a bunch of information. Click on Install Tool to get going…


Step 2. Run the Readiness Assessment.

Once the installation has completed, the tool will start up and give you the option to either scan a local or remote IIS server.


Click Continue to start the scanning process.


It will scan through all your websites and give you a list with possible migration candidates. Check the ones you want to be evaluated and click Next.


A Readiness Report is generated. You can now upload this report by clicking Upload.

Step 3. Migrate your website.

If the report didn’t detect any issues, you can start the migration process by clicking Migrate. This will trigger Web Deploy that will do the hard work for you.


Monday, November 17, 2014

Connect() on demand(in case you missed it)

In case you missed all the announcements at Connect(), it’s time to lock yourself up in your room and start watching all the videos.


Friday, November 14, 2014

DevIntersection 2014 – Interviewing developers

At the moment I’m in Las Vegas attending DevIntersection. Next to all the technical sessions, there was a whole track dedicated to leadership.


One of the sessions in the Leadership track was ‘Interviewing Developers’ by Billy Hollis. Here are some of the notes I made during the session:

  • Keep a professional attitude.
    • You are here to find the perfect match for your team not to get new friends.
    • Don’t try to become friends with the candidate. If you hire him (or her) you get time enough to get acquainted.
  • It’s a good idea to ask the candidate to send some code up front. This should not be a whole project but just some files the developer can share.
    • Unfortunately some developers work on proprietary projects and cannot provide any code.
  • Do a review of the application letter.
    • Chances are high that the candidate did write this letter himself, which could not be the case for his CV.
    • Don’t be merciful on spelling mistakes!
  • Do a full analysis of the CV.
    • Especially look at the project length and the time they stayed at the same customer(longer is better)
  • Listen to your first impression.
    • But don’t listen too much. :-)
  • Keep a neutral tone and posture during the interview.
    • People try to read your body language and change their answer accordingly.
  • Be aware for defensiveness
    • Development is a trial-and-error process. Making mistakes is part of our job. Look how the candidate handles mistakes and can learn from them.
  • Don’t make too much notes during the interview.
    • It distracts the candidate.
  • Ask open ended questions.
  • Avoid telephone interviews.
    • If it is not possible to see the candidate in person, use Skype(or a similar tool).
  • An interview should not take too long(not more than one hour).
    • After one hour, nature kicks in and the candidate will probably need to use the bathroom :-)

Billy also gave a whole list of sample questions which he asked not to share. So I will not add them here. If you want to know these questions, apply for a job at my company ;-)

Remark: Billy mentioned that he will probably create a Pluralsight course based on this talk, so watch out for it…

Thursday, November 13, 2014

DevIntersection 2014 – Visual Studio Announcements

At the moment I’m in Las Vegas attending DevIntersection. During the keynote by Steven Guggenheimer this morning, they shared some news about .NET and Visual Studio that was later repeated during the Connect conference.

Here are some of the highlights:

Enough announcements to keep us busy for a while…

More information can be found at:

Wednesday, November 12, 2014

DevIntersection 2014 – Cross platform mobile development and MacInCloud

At the moment I’m in Las Vegas attending DevIntersection. During the mobile development workshop I attended, the presenter mentioned MacInCloud, an online service to remote access a Mac in the Cloud.

I’m a cross platform mobile developer, why should I care?

If you are doing cross-platform development(with for example Xamarin), you’ll need a Mac sooner or later. Apple Licensing Terms doesn’t allow you to design and build your application on non-Apple hardware. So don’t think that creating a Virtual Machine and installing OS X on it, is a feasible solution.

Now you would think that the only option left is to buy a Mac, but Macs are expensive. Thanks to MacInCloud, you can use a Mac and only pay for the time you are using it.


Tuesday, November 11, 2014

DevIntersection 2014 - MobiZen

At the moment I’m in Las Vegas attending DevIntersection. During the mobile development workshop I attended, the presenter was using a great tool called MobiZen.

MobiZen allows you to share the screen of your Android device on your desktop or inside a web browser. You can even control your Android from your pc or laptop. This is the perfect tool not only during development but also when you want to demo some functionality to your client. And best of all, it’s free!


From the documentation:

Using your smartphone from your PC becomes a reality with Mobizen. Type using your keyboard, view photos and videos stored on your phone, and use mobile apps.

  • Photo: Share your special moments on a larger screen.
  • Music: The songs you listen to on-the-go can be enjoyed anywhere.
  • Videos: Watch videos and movies stored on your smartphone.
  • Files: Use drag and drop to transfer files between your smartphone and PC.

This will certainly become a new tool in my mobile development stack.

Friday, November 7, 2014

Free Azure and Office 365 Exams

To accelerate the adoption of their cloud technologies, Microsoft made the following MCP exams available for free:

  • 532: Developing Microsoft Azure Solutions
  • 533: Implementing Azure Infrastructure Solutions
  • 346: Managing Office 365 Identities and Requirements
  • 347: Enabling Office 365 Services

This offer is only valid until December 31, 2013 or while supplies last. So be quick and register for one or more of these exams.


Get your voucher here:

Good luck!

Wednesday, October 29, 2014

Angular AtScript

I heard some colleagues discuss if Angular.js will ever be written using TypeScript. The answer is no. In fact, the Angular.js team is using their own language AtScript to build Angular 2.0. The goal of AtScript is similar to the goal of TypeScript, it enhances the JavaScript language with some missing features without infringing upon its current capabilities.

Here are some of the enhancements and the philosophy behind the language from the Angular.js team design documents:


  • Type Annotations: Types allow us to explicitly express contracts between different parts of the system and to give these contracts names. For large teams with large codebases, where no single person knows the whole codebase, types become a key way to discuss and reason about the collaboration between different components of the system.

  • Field Annotations: Types are not only about contracts (API) but also about structure. In JavaScript the fields are implicit; they are created as a side effect of assignment. By giving the developer syntax to explicitly declare the fields, and warning upon implicit creation, we allow them to think about types in a more concrete way. By doing this we in no way sacrifice the flexibility of adding fields dynamically. We simply provide an optional tool to developers who can benefit from being more explicit.

  • Metadata Annotations: Many things in programming are best expressed in a declarative fashion. Declarative annotations allow frameworks to understand the meaning of your code without forcing a complex inheritance or lifecycle API. Examples where this technique has been used in the past include dependency injection libraries and web frameworks.

  • Type Introspection with Annotation Support: When we have annotations, it’s important to provide a consistent API that developers and frameworks can leverage to gain access to this information at runtime. The reflection API should also be backwards compatible with ES5 and ES6.


  • ES6 Baseline: ES6, or ECMAScript 6, is the latest version of the Ecma International language popularly know as JavaScript. It includes many improvements such as a formal class declaration syntax, promises, modules and consistent variable scoping.

  • Backwards Compatibility: Types, fields, metadata annotations and reflective access need to be added in a way which does not break the existing syntax or semantics of ES6/ES5. AtScript needs to be a more succinct way of expressing what is already possible in these languages. ES6/ES5 code must be valid AtScript code without any changes to the semantics. Any developer who has written ES6/ES5 code can immediately get started with AtScript. In other words, ES6/ES5 are strict subsets of AtScript. All the code you are used to writing today will work without alteration with AtScript, but now you can take advantage of the enhancements to the language which will allow you to express your ideas in a more concrete way.

  • Familiar Syntax: We desire to use a syntax which has been tried, is time tested and is most likely to become the next standard. This means using ':' to indicate type annotations (proposed in ES4 and used by TypeScript), '@' for metadata annotations (used by java, dart and others) and 'name:Type;' for field annotations (used by java, dart, TypeScript and others).

  • Pragmatic Approach: The goal is not to build a type system that is correct 100% of the time. Rather, we want to be flexible and useful in the vast majority of real-world scenarios.

  • Semantics Agnostic: Type system theory is a complex field with many tradeoffs. It is our explicit goal to leave the semantic discussion as well as the assertion system outside of the scope of AtScript. Instead we want to provide hooks for others to build runtime type assertion libraries and static analyzer tools with their own semantics. In this way we believe that we can spur innovation in the area of type systems by lowering the barrier to entry.

The Angular.js team was certainly inspired by TypeScript but they choose a different path:

The AtScript has been influenced by TypeScript and Dart. Here we would like to discuss why these existing solutions do not meet our needs.


  • Types are analyzed statically only.

    • Static analysis makes it difficult to have optional types, since static analysis can not analyze what is not typed. (type inference has its limits)

    • Static analysis can not be used to assert that the JSON returned from the server has valid structure.

  • Lacks meta-data annotations

  • Provides no mechanism to access the annotations at runtime


  • Dart is semantically different from JavaScript. The resulting Dart2JS code uses JS as more of a VM than a language. The result is that Dart2JS code can not easily interoperate with JS code. Only primitive types (such as strings, numbers, arrays, maps) can be passed between Dart and JS. Complex things such as classes can not be marshaled easily.

    • Existing JavaScript libraries can not be used from Dart in a straightforward way. Limiting reuse of prior art.

As a frequent TypeScript and Angular.js user, I see what benefits AtScript brings to the table. One thing is certain, the Angular future looks promising…

Tuesday, October 28, 2014

ASP.NET Custom Headers–X-UA-Compatible=‘IE=Edge’

If you are building a ‘modern’ web application for Internet Explorer, I would recommend to enable the following header inside your web.config:

Using this header will enable ‘Edge mode’ inside IE. It represents the highest support for modern standards available to the browser. In other words, it tells Internet Explorer to use the highest mode available to that version of IE; e.g. Internet Explorer 8 can support up to IE8 modes, IE9 can support IE9 modes and so on. Edge mode was introduced in Internet Explorer 8 and has been available in each subsequent release. Note that the features supported by edge mode are limited to those supported by the specific version of the browser rendering the content.

Remark: Starting with IE11, Edge mode is the default mode. Other document modes are deprecated and should no longer be used, except on a temporary basis. Make sure to update sites that rely on legacy features and document modes to reflect modern standards. 

Monday, October 27, 2014

Building cross-platform mobile apps in Visual Studio

Interested in building cross-platform mobile apps using Visual Studio? Microsoft made this easy thanks to the Multi-Device Hybrid Apps Visual Studio extension. This extension allows you to combine Visual Studio and Apache Cordova to easily build hybrid apps that run on iOS, Android, Windows, and Windows Phone using a single project based on HTML and JavaScript.


The extension is available for download here.

Remark: Be aware that the extension will download and install some additional dependencies, including

  • Joyent Node.js
  • Git CLI
  • Google Chrome
  • Apache Ant
  • Oracle Java JDK 7
  • Android SDK
  • SQLLite for Windows Runtime
  • Apple iTunes

More information can be found at

Friday, October 24, 2014

Internet Explorer–What’s coming next?

Do you want to know what HTML/JavaScript/CSS features will be supported in future versions of Internet Explorer? brings you the answer. You see all the features that the IE team is considering to support(and you even can see the support for other browsers).


Thursday, October 23, 2014

ASP.NET MVC–CS0234: The type or namespace name ‘’ does not exist in the namespace ‘System.Web.Mvc’

Sometimes you have these issues that always appear randomly. You know you have seen these issues before, but you can’t remember how you fixed them Verwarde emoticon.

Today I opened up the project I was working on for the last month to see the following error:

CS0234: The type or namespace name ‘’ does not exist in the namespace ‘System.Web.Mvc’


I first tried all the obvious things when you have such an unexpected error:

  • Clean the solution and rebuild the project… Didn’t help
  • Restarting Visual Studio… Didn’t help
  • Delete everything from the Temporary ASP.NET Files folder… Didn’t help
  • Got another coffee at the coffee corner… Didn’t help but I felt a little bit better

Finally I noticed that I had switched between configuration modes. Inside the Debug configuration mode, I noticed that Copy Local was set to False for System.Web.MVC. When I changed Copy Local to True everything was working again.

Wasted one hour…

Tuesday, October 21, 2014

TFS Performance Tips

Last week I noticed the following blog post by Cory House; Two Quick TFS Performance Tips.

It’s a small post, but one with great value…

In his post, he shares one of the greatest performance tips ever about TFS; create a separate workspace for each Team Project. How many times I heard a developer complain that TFS was slow and cumbersome to use… And when I took a look at his Visual Studio solution I had to discover that his 5 years of developer work was all sitting in the same workspace. Ugh…


Monday, October 20, 2014

Announcing Microsoft Connect event

On November 12th,  Microsoft is hosting an online developer event called Connect();Connect(); will be a chance to have a conversation with developers about what’s coming next for developer tools, developer services and application platforms across Microsoft.

From the website:

Connect(); is a cloud-first, mobile-first, code-first virtual event focused on current and future Microsoft technologies for developers. Build on your current skills, unleash your creativity, and expand what's possible to deliver unprecedented innovations.”


So if you have any questions about what’s coming next in ASP.NET, this is a great opportunity to get some answers…

Friday, October 17, 2014

Angular.js: Using ngAnnotate inside Visual Studio

Last week I discovered a great NPM module; ‘ng-annotate’.It adds and removes AngularJS dependency injection annotations.

The great thing is that allows you to use implicit dependencies in Angular.js and ng-annotate will automatically make the switch to the Inline Array annotation.

This means that you write  the following code:

And that it gets rewritten automatically to:

The only problem is that I have to run ngAnnotate from the commandline. As a Visual Studio user, I would like to have an integrated solution. Let’s see how we get this done…

Integrate ngAnnotate into Visual Studio

To make integration possible, we’ll use some Visual Studio Extensions. So let’s install them first.

  • Start with installing(or upgrading) to the latest version of Web Essentials.
  • Also install node.js on your system.
  • Now it’s time to install Task Runner Explorer. This will allow you to run Grunt and Gulp tasks directly from within Visual Studio.
  • You can also install the Package Intellisense plugin. This is not required but makes it a little bit easier to use NPM from inside Visual Studio.

Now that we have all prerequisites installed, it’s time to get back to ng-annotate. There exists a ng-annotate plugin for both Grunt and Gulp. Which one you use depends on your own preferences but the process is similar. I will show you how to do it using Grunt. But first we have to install Grunt itself:

  • Open a command prompt and install the Grunt command line interface globally by using the following command:
    • npm install -g grunt-cli

Open your web project inside Visual Studio. It’s time to add some extra files:

  • Add a package.json file to the root of your web project. Also add a gruntfile.js file.


  • Inside the package.json, add the following content. In this case I also added a dependency to some other NPM packages to minify and uglify my code:
  • Right-click on the package.json file and choose NPM install packages. (If you don’t see this option, open a command prompt and do an npm install from the package.json location).


  • After the packages are installed, it’s time to create our gruntfile.js:


We finally arrived at the moment where we can run the Task Runner Explorer:

  • Right-click on the gruntfile.js in Visual Studio and choose Task Runner Explorer.


  • This will open up the Task Runner Explorer and show all available Grunt tasks.


  • Right click on the ngAnnotate task, choose Bindings and click on After build. Now each time we build the ngAnnotate task will automatically rewrite our Angular.js code to add the missing annotations.



Thursday, October 16, 2014

Angular.js 1.3: The ng-strict-di directive

Angular.js 1.3 introduces a new directive: ‘ng-strict-di’.

<div ng-app="myApp" ng-strict-di>

From the documentation:

if this attribute is present on the app element, the injector will be created in "strict-di" mode. This means that the application will fail to invoke functions which do not use explicit function annotation (and are thus unsuitable for minification), as described in the Dependency Injection guide, and useful debugging info will assist in tracking down the root of these bugs.

To explain this a little bit more; Angular.js does (implicit) dependency injection based on the name of the object you try to inject. So if you specify a parameter as ‘$scope’ it will look for an object called ‘$scope’. This works great until you start using minification. When you minify your JavaScript, the function parameters are shortened to a random letter, e.g. ‘d’. When the injector runs this minifies JavaScript it no longer searches for a ‘$scope’ object, but for a ‘d’ object instead. As this object does not exists, dependency injection will fail.

A solution for this is explicitly specifying the dependencies as strings(called explicit function annotation). The ‘ng-strict-di directive’ will check if this syntax is used and throw an exception otherwise.

You can use the $inject Property annotation or use the Inline Array annotation:

Wednesday, October 15, 2014

Another free Xamarin e-book

There is really no excuse anymore to at least read one book about Xamarin. After the free ‘Master Cross-Platform Mobile Development with Xamarin ebook’ I mentioned last week, there is now another free ebook: Creating Mobile Apps with Xamarin.Forms, Preview Edition: Cross-platform C# programming for iOS, Android, and Windows Phone, by Charles Petzold. This ebook was created jointly by Xamarin and Microsoft Press.


This Preview Edition ebook is about writing applications for Xamarin.Forms, the new mobile development platform for iOS, Android, and Windows Phone unveiled by Xamarin in May 2014. Xamarin.Forms lets you write shared user-interface code in C# and XAML (the eXtensible Application Markup Language) that maps to native controls on these three platforms.

This ebook is a Preview Edition because it's not complete. It has only six chapters. We anticipate that the final version of the book will have at least half a dozen additional chapters and that the chapters in this Preview Edition might be fleshed out, enhanced, or completely reconceived. The final edition of the book will probably be published in the spring of 2015.

You can download PDF and Mobi formats at the Microsoft Virtual Academy.

Tuesday, October 14, 2014

Log database activity in Entity Framework

A quick tip if you want to log what’s going on inside Entity Framework:

This will log not only the query, but also other useful information like the execution time, etc…

Monday, October 13, 2014

Fake asynchrony: Avoid the JSON.NET async APIs

As a developer I frequently build my own libraries or re-use existing ones. In the new async/await world, you have to consider if you implement an async version of your library.  However one thing that is important is to avoid “fake asynchrony”. Fake asynchrony is when a component has an async API, but it’s implemented by just wrapping the synchronous API within a task or thread.

This will lead to unexpected behavior and can decrease performance. One example of fake asynchrony is Newtonsoft JSON.NET, the known (and great) JSON serialization library. The creators of JSON.NET are already aware of this issue and made the async API’s obsolete:


Friday, October 10, 2014

Angular.js and ASP.NET MVC: IsAjaxRequest returns false when using $http

In an application we are combining Angular.js on the client and ASP.NET MVC on the server. This all works great until we added a call to Request.IsAjaxRequest inside our MVC controller:

Inside the controller action we check if we have an AJAX request. If this is the case we return a JSON result otherwise we return an HTML view.  We’ve used similar code(in combination with jQuery) in previous projects without any issues. But when calling the MVC action method through Angular’s $http service, we noticed that the Request.IsAjaxRequest() method returned false.

When comparing the requests issued by Angular $http versus jQuery $.get() we noticed one small difference. The xhr call initiated by Angular doesn’t contain the X-Requested-With header. And this is exactly the header ASP.NET MVC is looking for to detect if it’s an AJAX request or not.

We can easily fix this by changing the $httpProvider configuration to include this header with every request:

Thursday, October 9, 2014

Master Cross-Platform Mobile Development with Xamarin

The guys from Falafel are offering a free e-book about Cross-Platform Mobile development with Xamarin.

Go download your copy here(registration required).