What’s new in WCF 4.5? Configuration tooltips and intellisense in config files
This is the third post in the WCF 4.5 series, and we’re still in the subject of configuration, but this time is about intellisense and tooltips in configuration files.
1. What’s new in WCF 4.5? let’s start with WCF configuration
2. What’s new in WCF 4.5? a single WSDL file
One of the things that is truly annoying in WCF is the part of configuring the service using configuration files - you have to remember a lot of things by heart and type them without intellisense:
- Service/contract names (see my post about it)
- Names of behavior/binding configuration sections
- Binding names (is it netNamedPipeBinding? or maybe netNamedPipesBinding?)
- Standard endpoint names
Some of us choose to use the WCF Service Configuration Editor in order to get around this problem, while others choose to use the famous copy&pasting – copying names and settings from one place to the other (for example, copying the name of a service behavior to the service definition).
With WCF 4.5 things just got a bit better with the new intellisense support in configuration files. This is actually not a WCF 4.5 feature, but more of a Visual Studio 11 feature, since you will also be able to get intellisense when creating WCF 4 services, but I don’t want to ruin the “What’s new in WCF 4.5” title streak.
Let’s see some of the intellisense options in action.
The intellisense shows services from all referenced assemblies, so you can see here services that are implemented in the current project, referenced from other projects, and also services from referenced system.serviceModel.* assemblies, such as Discovery services and Routing services (if they are referenced).
Again, the intellisense shows contracts from various sources. Suggestion to Microsoft – Why not show me only the contracts that apply to the current service I’m configuring (you can find it according to the service’s name), plus some known contracts such as IMetadataExchange. By the way, the IMetadataExchange is show in the intellisense (it’s missing from above image because of the scroll):
You get all the known bindings, quite straightforward.
With intellisense, we get both named behavior configuration and default behavior configuration sections.
Same applies to endpoint behaviors:
As you can see, the intellisense is showing the binding configurations I’ve declared, but unfortunately they are not filtered according to the binding I’ve selected for this endpoint. Hopefully this is something that will be fixed in the RTM.
All of these intellisense options are very nice and will help reduce the complexity of configuring a service without the use of the graphical tool (the WCF configuration editor), however, I am missing one small intellisense/validation feature that I think is necessary – making the editor recognize extensions, so it will stop marking then as warning, and also if possible, add them to the relevant intellisense list.
For example observe the following extension usage in Visual Studio 11:
As you can see in the above image, the serviceErrorHandler behavior extension is marked as a warning, and does not appear in the behaviors list. Perhaps the first step in solving this issue is to separate the behavior extensions to service behavior and endpoint behaviors.
In addition to having intellisense, we also have new tooltip support for most settings, so now if you hover over a WCF-related attribute you will be able to see a short explanation about it:
It not as explanatory as the tooltip you get when using the WCF service configuration editor, but at least it’s something:
Stay tuned for more posts about the new features of WCF 4.5. You can also follow me on Twitter (@IdoFlatow) to get updates as soon as new posts are published.
The RTM of .NET 4.5 is still to come, and I assume many of you are still adjusting to WCF 4. If you want to learn more about the new features of WCF 4, come to mysession at Visual Studio Live! 2011 in Redmond (October 17-21).
Also, if you are an MCT and reside in the US, come hear my session about WCF 4 at the MCT 2011 North-America Summit that will be held in San-Francisco (October 19-21).