What did we learn this week? Week of 13 april 2009

links for this week:

unit testing windows forms applications and more perticular: databinding
While working on some code which encapsulates windows forms controls, I had to check if my abstraction works. And especially, if the databinding works:
Unit Testing WinForms 2.0 Databinding

Adding features to Visual Studio 2008
It had happened to me before but this time I had to succeed: I needed to install the crystal report features which are part of visual studio. Unfortunately, starting the setup form the dvd failed with the error: “A problem has been encountered while loading the setup components. Canceling setup.” After some research following post helped me (make sure you read it until the end):
Adding features to Visual Studio 2008 may fail to load setup components


What did we learn this week? Week of 19 januari 2009

Links for this week:

Global namespaces
I wanted to name a namespace “CompanyName.System” which turned out to be a bad idea: it gave me the unfortunate compiler error “The type or namespace name ‘SomeClassName’ could not be found”. The solution is easy according to the MSDN article How to: Use the Namespace Alias Qualifier (C# Programming Guide) but unfortunately the error happened in the designer file of a Windows.Form and there is no point in changing any code there. I suppose Microsoft should use the global:: identifier in generated code but they don’t. Or is there a solution I’m overlooking?

WCF Service hosting and Client access in a Windows Forms application
Actually, I came across this one too late. Last week I made a test application which was I simple Windows Forms application whome hosted a WCF service and connected to that same WCF service. A big NO GO was the result, as this guy also experienced…

WCF Services with constructor parameters
I eventually didn’t use it, but I had a use case this week for having a WCF service in which the constructor would have some parameters. An alternative could be to provide the object instance to use for implementing the service yourself instead of letting WCF instantiate it for you as the standard behaviour is. Again, I’m not the first one willing to do this as these links prove:
Unity & friends: The WCF service host side
WCF Dependency Injection Behavior
WCF Service Dependency Injection

Generics in .Net
I’m still getting used to this. Comming from a C++ background I’m still suprised by compiler errors trying to use a template parameter as a base class, or as an attribute parameter. In C# this is not allowed. Why? Read these posts:
Generic argument as a base class
Generic argument as a base class
Using Generic Parameter as an Attribute constructor parameter