So continuing on my WCF 4.5 posts – and expanding on the configuration simplicity theme – I’ll dedicate this one to the simplification efforts we have done to ease configuring WCF services.
Tooltips support and extended IntelliSense
Many folks have a tough time while dealing with the numerous knobs we have in the WCF configuration system. All these different configuration settings while providing immense flexibility, also add to the complexity – developers need to know each knob and also remember which knob is for what purpose. So we thought what can we do to help the developers here – we looked around and saw editors like the C# editor in Visual Studio providing nice little features of Tooltips and IntelliSense which boost developer productivity substantially and we decided to adopt them for WCF Xml configuration as well!
Tooltips support is now available for WCF configuration elements and its properties in the Xml configuration editor:
The tooltip message is the same as what shows up in the description of the configuration element in the WCF configuration schema documentation in MSDN. I will admit that some of the MSDN descriptions do lack in clarity and seem ambiguous but we are always improving the documentation on MSDN.
There is some existing IntelliSense support for WCF configuration already however in Visual Studio 2011, we have extended this further to cover some of the scenarios where we think this will be super useful.
Lets walk through how you configure when you have created a service and operation contract and written your WCF service implementing them. You open up the .config file and if you are the brave one – you start editing it by hand!
Starting with the service tag – we now auto populate the available services:
OK – that’s done – then you start adding configuring the service:
a. starting with the binding –
b. or the contract
c. Or any named service or endpoint behavior which you already created:
As you saw – we now auto populate all of it for you to just click and select – no more copying/pasting or typing it by hand. This will eliminate all those crazy spelling mistakes where you thought you named it EndpointBehavior but it was actually EndpointBehaviour and you were pulling out your hairs about why the service was behaving in unexplained manner!
Not only this – even if you decide to ignore the IntelliSense and make mistakes – you will see validation instantly lighting up and preventing you from doing this:
And if you don’t listen to it – it will also show up in the Warnings on the debug window:
Note on the internal working –
When a user opens up the XML editor to modify the WCF service configuration file, it reads the dotNetConfig.xsd document, which ships with Visual Studio (located here – " \\Program Files (x86)\Microsoft Visual Studio 11.0\Xml\Schemas\DotNetConfig.xsd) and this file contains the .NET framework configuration schema. The XML editor uses this schema to perform validation (adding those red/blue squiggles) and provide tooltips. The tooltips information is extracted from the xs:annotation\xs:documentation tag:
Since this schema definition file is picked for all application templates in Visual Studio when you are modifying the xml configuration file – this means that you will get the added IntelliSense and Tooltips support whenever you are dabbling in configuration under system.serviceModel section in Visual Studio 2011, be it WCF service application template or some console application while creating self-hosted service.