Skip to main content


Showing posts from September, 2012

WCF Data Service: Error processing request stream. The property name Discount specified for type Order is not valid.

For a project we are using  a WCF Data Service. By using “Add service reference” we generated all the classes and a context on the client side. To simplify the usage of these classes, we want to extend some of them with some extra properties, e.g: public partial class Order { public int Discount { get { return CalculateDiscount(); } } } After setting this up, we couldn’t no longer send updates to the server, instead we always got the following error message back:  "Error processing request stream. The property name 'Discount' specified for type 'Order' is not valid." How can we tell WCF Data Service to ignore this property? On the server side, doing this is easy. There is an IgnoreProperties attribute class that you can use to control the visibility of a property in a WCF DataService class. But this one is meant to be used on the server side not the client side. But with some extra code, you can get the same thing don

2 useful tools for the TFS administrator: TFS Power Tools 2012 & TFS Team Project Manager

Looking for some tools to simplify your job as a TFS administrator? These are 2 of the ‘must have’ tools: Microsoft Visual Studio Team Foundation Server 2012 Power Tools This is the latest update of the TFS Power Tools with support for Microsoft Visual Studio Team Foundation Server 2012. Best Practices Analyzer A diagnostic tool that you can use to perform the following actions: Verify that the deployment for Team Foundation Server is configured according to recommended best practices Identify the source of problems in an unhealthy deployment Take a snapshot of the configuration of a deployment Obtain usage data about the volume of data stored or accessed in the past 14 days. Includes specific information about database tables that have a tendency to grow and that may need to be reduced in size. Process Template Editor A Visual Studio 2012 add-in, located under the Tools menu, the Process Template Editor provides a graphical user inter

Gartner report: Microsoft takes the lead in the Application Lifecycle Management(ALM) space

According to a recent Garner report Microsoft takes the lead in the ALM space. By virtue of its position in the market as a provider of key platforms and development tools, Microsoft acts as an overall thought leader in the ALM market. However, this breadth and a late start in the ALM market have caused its tools often to lag other products, although it is now introducing innovations. At this point, other than IBM, Microsoft offers the broadest set of ALM functionality in the market. The company tends to deliver new releases every 18 months, but generally needs to coordinate with key platform updates and initiatives. To make up for long development cycles, the product team uses the Microsoft Developer Network (MSDN) to deliver "Power Tools" and other early access software bits. Microsoft has a broad customer base going from small or midsize businesses (SMBs) up to extremely large enterprises, and its largest sites have more than 10,000 users. Unlike all of the other

TFS 2012 Web Access: Export Work Item query results to Excel

After upgrading to Team Foundation Server 2012, I got the following question from one of our PM’s: “In TFS 2010 Web Access I could export my work items to excel. How could I do the same thing in TFS 2012 Web Access?” Unfortunately there is no direct way of doing this. I know only two possible alternatives/workarounds: Install Team Explorer 2012. This will give use an extra Team tab in Excel and makes it possible to import the work items directly. Use the good old copy/paste trick: Select the work items you want to export from a query result Press Ctrl+C or open up the popup menu by clicking the down arrow icon on the left of one of the selected work items and click copy (at the bottom) Press Ctrl+C Paste to Excel Anyone with a better alternative?

Windows 8 Camp in a box

For the last months, Microsoft organized Windows 8 camps around the world. The Windows 8 camps are free training events for developers ramping up on Windows Store app development. If you couldn’t make it to any of these camps, I have the following tip for you: Windows 8 Camp in a box . This download includes the hands-on-labs, presentations, samples and resources from the Windows 8 camps.

WinRT: A method was called at an unexpected time. WinRT Information: An eventhandler has already been registered.

For a WinRT application I’m building I decided to support the Share charm. This is done through the use of the DataTransferManager class. So in the constructor of my page, I added the following code to listen for Share requests: _manager = DataTransferManager.GetForCurrentView(); _manager.DataRequested += manager_DataRequested; This seems to work fine but when I moved to another page and navigated back afterwards, I always got the following error message: “An exception of type 'System.InvalidOperationException' occurred in mscorlib.dll but was handled in user code. A method was called at an unexpected time.WinRT information: An event handler has already been registered” I first tried to solve it by unregistering the event handler in the constructor before registering it but this didn’t help : _manager = DataTransferManager.GetForCurrentView(); _manager.DataRequested -= manager_DataRequested; _manager.DataRequested += manager_DataRequested; Instead you have to

Team Foundation Server 2012 and Visual Studio Compatibility

After upgrading our internal Team Foundation Server environment to the 2012 version, I got a lot of questions from our development teams about compatibility with different Visual Studio versions. To help them(and you) here is the compatibility matrix(the full matrix for all TFS versions is available here ): Clients and tools Team Foundation Server 2012 Visual Studio 2012 or Team Explorer 2012 Yes Visual Studio 2010 or Team Explorer 2010 Yes (1) Visual Studio 2008 or Team Explorer for Visual Studio Team System 2008 Yes (2) Team Explorer for Visual Studio 2005 Team System No (3) Team Web Access for Team Foundation Server 2010 Not applicable Team Web Access for Visual Studio Team Foundation Server 2012 Yes MSSCCI 2008 No MSSCCI 2010 No MSSCCI

Microsoft Web Essentials: a must have Visual Studio Extension for every web developer

With the release of Visual Studio 2012, Microsoft also updated some of their Visual Studio extensions. One of the extensions I like a lot are the Web Essentials tools and although the live of a web developer becomes a lot easier in Visual Studio 2012, there are still some missing features. Web Essentials 2012 tries to fill this gap. So what’s new in this version? Option dialog: Now it becomes possible to set the most important options through this dialog. JSHint for JavaScript: JSHint is a really good way of making sure your JavaScript follows certain coding guidelines and best practices. Better LESS and CoffeeScript: The LESS editor has been updated to truly take advantage of LESS. This includes: Support for @import directives Intellisense across imported .less files for Mixins and variables All the validation from the CSS editor now shows up in LESS Both CoffeeScript and LESS now uses the official compilers Compiles and creates a .cs

Error when trying to publish Azure application: Server failed to authenticate the request.

Last week I wanted to deploy an Azure application. So I used the publish options inside Visual Studio to start the deployment process. But after a few seconds it failed with the following error message: “Server failed to authenticate the request.” I double checked my credentials, downloaded a new publish contract, I even created another account to test it with other credentials. Nothing helped… Until I saw in the authentication header that the provided time was not correct. I noticed that the clock on my development machine was 20 minutes behind the real time. Because the UTC time on my local machine was too far out from what the Azure servers say, they revoked my request. I updated my local machine time and publishing succeeded without any issues.

Storyboarding in Visual Studio 2012: now also for iOS, iPhone & iPad

One of the great new tools in the Visual Studio ALM ecosystem is the Powerpoint Storyboarding . It allows you to create great screen mockups in a familiar user interface(Powerpoint). Last week Microsoft released three new sets of storyboarding shapes on the Visual Studio Gallery . Common iOS Icons iPhone controls iPad controls

The Transient Fault Handling Application Block

While looking for some good error handling strategies for cloud solutions, I found the following Microsoft Patterns & Practices Application Block: The Transient Fault Handling Application Block. From the site: The Microsoft Enterprise Library Transient Fault Handling Application Block lets developers make their applications more resilient by adding robust transient fault handling logic. Transient faults are errors that occur because of some temporary condition such as network connectivity issues or service unavailability. Typically, if you retry the operation that resulted in a transient error a short time later, you find that the error has disappeared. Different services can have different transient faults, and different applications require different fault handling strategies. The Transient Fault Handling Application Block encapsulates information about the transient faults that can occur when you use the following Windows Azure services in your application: S

TFS 2012: Some features of Team Web Access are not visible to you.

After upgrading our TFS environment to Team Foundation Server 2012, the first time we logged on  in to TFS Web Access, we got the following message “Some features of Team Web Access are not visible to you” . This is caused by the licensing model used for Team Web Access. You have 3 possible license levels: Limited: This level of access restricts the user so that they can only view work items that they create in Team Web Access (also known as Work Item Only View). No other features, such as team pages, are available to users in this group. No client access license (CAL) is required for this level of Team Web Access. Standard: This is the default level of access in Team Web Access for your users. Members of this group can view all Team Web Access features except for: sprint planning and backlog views any of the features for requesting feedback from users and managing that feedback

Custom web.config transforms

One of the nice features of Visual Studio 2012(and also Visual Studio 2010) is the ability to use Web.config transformations . However the list of supported transforms is  somewhat limited. I was looking for a way to execute a transformation only if a specific element doesn’t exist yet in your root web.config file. I discovered that Web.config transform engine can be extended to support additional transformations. On the AppHarbor blog , I found a sample transformation that exactly did what I needed:  using System.Linq; using System.Xml; using Microsoft.Web.Publishing.Tasks; namespace AppHarbor.TransformTester.Transforms { public class Merge : Transform { public Merge() : base(TransformFlags.UseParentAsTargetNode) {} protected override void Apply() { Apply((XmlElement)TargetNode, (XmlElement)TransformNode); } public void Apply(XmlElement targetElement, XmlElement transformElement) { var tar

TF30172: You do not have permission to create a new team project.

Last week a colleague tried to create a new team project on our freshly installed Team Foundation Server 2012 environment. But when he choose the Add new Team Project option from Visual Studio 2010, he got the following error back: TF30172: You do not have permission to create a new team project. Don’t be fooled, this error has nothing to do with security. So don’t go check all your permissions, it will not help. Instead open up Team Explorer 2012(or Visual Studio 2012) and create the new project from there. That’s it!

Windows 8: Setting the application theme

In Windows Phone you had a global Theme setting on your mobile phone which allows you to switch between the dark and light theme. One thing I didn’t like is that you had to use some tricks to detect the currently active Theme setting. In Windows 8 Microsoft is taking a different approach: there’s no global theme setting , instead it’s up to the developer to decide if her application uses the dark or the light theme. You can set the current theme by changing the RequestedTheme -attribute on the Application class. This can be done either through code or through XAML. <Application x:Class="ThemeSample.App" xmlns="" xmlns:x="" RequestedTheme="Light">

Windows 8: Use custom fonts

For a Windows 8 app I’m building, I wanted to use a custom font. It took me some time to figure out how to get this working. So here are the steps: Add the font file to your project. Change the Build Action to Content . Specify the FontFamily using the format: /<path to font file>/<font file>#<font name> If you don’t know the font name, double click on the font file: A sample: < TextBlock FontFamily = "/Assets/Fonts/Bauhaus93.TTF#Bauhaus 93"/>  

TFS: Work Item Field Reference

Are you customizing the Team Foundation Server Work Items? But you don’t have a clue about all the possible fields? Last week I found this blog post by KathrynE . Here are two new resources you can use to look up a definition and quickly see which fields are written to the relational database and which are stored in the Analysis Services cube. These cover all the fields defined in the process templates that Team Foundation Server 2012 provides. Work Item Field Reference for Visual Studio ALM : Provides an index to all fields used in the default process templates that TFS 2012 provides. Each field links to a topic that describes the field and its default attribute assignments. Reportable Fields Reference for Visual Studio ALM : Provides a description of all fields that are reportable, and whether they appear in the cube, and which ones are a measure. For an overview of the attributes that are defined for each field, see Work Item Field Attributes - What You Can and Can&

Windows 8: Uniquely identifying a device

For a Windows 8 application I’m building, I needed a way to uniquely identify a user’s device. The best option I found was using the HardwareIdentification value. The only problem it has is that it can change if your system hardware changes(but that’s good enough for me ) O yes, here is the code I used: private string GetHardwareId() { var token = HardwareIdentification.GetPackageSpecificToken(null); var hardwareId = token.Id; var dataReader = Windows.Storage.Streams.DataReader.FromBuffer(hardwareId); byte[] bytes = new byte[hardwareId.Length]; dataReader.ReadBytes(bytes); return BitConverter.ToString(bytes); }

Windows 8: Could not initialize secondary tile with provided arguments.

In a Windows 8 application I tried to add a secondary tile when I got the following exception: “Could not initialize secondary tile with provided arguments.” I discovered that the issue was cause by the image I specified. I was using a URI pointing to a resource on a website. According to the documentation this is not supported. The only valid options are: ms-appx:/// : A path within the deployed app package. This path is resolved for languages and DPI plateau supported by the app. ms-appdata:///local/ : A file found in the per-user app storage. So if you want to use a resource from the web, you have to download it first and add it to the users local storage folder. Remark: Note that images are supported for secondary tile notification updates.

Windows 8: Cannot await in the body of a catch clause

While I was writing some async code in .NET 4.5, I decided to add some exception handling. So I created a try/catch block and wanted to show a message dialog when an exception occurs. However when I added an await to wait for the message dialog result, the compiler started throwing exceptions: The error message stated: “Cannot await in the body of a catch clause.” I solved it by introducing a flag bool exceptionOccurred=false; and setting it to true in the catch block. After the catch clause I added some code to check if the flag is true. catch(FileNotFoundException ex) { exceptionOccured=true; } if(exceptionOccured) { await new MessageDialog().ShowAsync(); } Anyone with a cleaner solution?