Type typename is not CLS-compliant, interface, tests and dependency injection

OK - here is a strange one… [UPDATE ON THIS POST - SEE http://www.marcusoft.net/2008/03/real-answere-type-typename-is-not-cls.html]

We are using dependency injection to be able to inject mocked version of classes that the class we’re testing is using…. (oh, my god - requires another blog-post i think… i’ll get back).

So the first thing we did was to extract interfaces for all the methods the implementation is using. So far so good.

But when i mocked the implement ion of the interface we got a quite strange warning:

Type ‘KodBenamning’ is not CLS-compliant.

Apparently this occurs when a type is referenced by an interface (as parameter or return type) AND the type is not marked with

CLSCompliant(true)

which, by the way is NOT default, of course…. So - the solution is to mark all your classes used by interface with CLSCompliant(true) and it will work…

Read More

Show current file in solution

Ooooh - so nice. And so easy now when i know how to do it…

When you get large solutions and there are loads and loads of files in the Solution Explorer you’ll sometimes (often, in my case) get confused on where you are…

I organize my projects in Solution Folders but still get quite hard to follow, especially when you are the codriver…

But it turns out to be easy to solve. There is a setting in the Options-dialog of the Studio (both 2005 and 2008, luckily) that is called Track Active item in Solution Explorer. When this is checked the file you currently is watching is found and highlighted the Solution Explorer which greatly reduces confusion on where you are.

The setting is found under Tools->Options->Project and Solutions->General->Track Active item in...

Read More

TF 20017 - The area or iteration provided for field 'IterationPath' could not be found

OK - the first problem i ran into when using the Conchango template was the first thing i ever did in the project - create a sprint “work item”. This type of WorkItem represents a sprint and hold all the sprint backlog items that is to be done in the sprint.

What i wanted was to give the sprint a name when the error message “TF 20017 - The area or iteration provided for field ‘IterationPath’ could not be found”

Well after almost a complete day of surfing and phoneing and scratching of heads i found the error. The name is not a textbox but rather a dropdown! More specifically the sprints in the Conchango template is constructed around the notion of areas and iteration paths. The have created a few for you, out of the box.

These make up the sprints for the project and hence needs to be...

Read More

WCF - introductions

We’re planning on using WCF for the next project and i have been scavenging the Internet for good introductions to WCF and to message based calls.

Here what i have found so far:

A good highlevel article from MSDN - http://msdn2.microsoft.com/en-us/library/aa480190.aspx

Some great and simply screen cast on how to use Visual Studio 2008 and WCF by Darryl Burling:

The difference between Messaging and RPC

I’ll hunt some more and put the links up here.

Read More

Doing SCRUM in TFS

I am starting off a new project next week and we are going to run it as a SCRUM project (of course, there is no other way now is there :)) .

Since our team is highly distributed we’ll need some sort of support to keep the SCRUM-heartbeat going. Let right now say that having distributed team is not a choice of anyone in the project, that just how it is and we’ll have to live with it.

So Team Foundation Server is used at my customer and that is how we will manage the project, code and documentation. We are also going to use the SCRUM-project-template from Conchango.

However this is not good at all in my opinion. You force the team members to update their work in Team Explorer before any Daily Scrum can be held, effective. For the team members that will be just an other...

Read More

Solution to the "Could not find file 'Microsoft.Windows.CommonLanguageRuntime error" for testprojects

Here is the solution to my previous posting Could not find file ‘Microsoft.Windows.CommonLanguageRuntime error for testprojects.

As always it is simple when you know how. You simply uncheck the Enable ClickOnce security settings-checkbox under Projects->Properties->Security.

A better solution is the extract the code that is to be tested to an own project, but I’ll use the above for now. We’re only using ClickOnce for testing environments.

Read More

TypeMock - an introduction

I my next project (which is mega-cool, I’ll get back) i will start using TDD from the outset, which seems to be the only way to get it to work. To do that we’ll need a mocking framework and the flavor of the month seems to be TypeMock.

There are not many very good introductions on the net but here are some that are the best so far:

PS Following a really fast answer (ca 4 hours after my posting) from the TypeMock-team (this Internet thingy is so cool, isn’t it) i want to add two movies:

Read More

Whose line is it anyway?

I ran into an old friend during the weekend. This is an old (80s?) show with improvisation theatre as game between four comedians. It is hilarious!

I met this program again on YouTube. There are loads of clips there. Start here.

Here is one of them that made me laugh out loud.

Read More

Could not find file 'Microsoft.Windows.CommonLanguageRuntime error for testprojects

We have encountered a quite annoying bug when creating a test project that references a Windows application. The Windows application have been deployed via ClickOnce and that when the testproject stopped compiling.

In the test project we got the “Could not find file ‘Microsoft.Windows.CommonLanguageRuntime” error message on compilation.

Here is an article describing that problem: http://support.microsoft.com/kb/907757. No very good solution though. I’ll post out solution in a while.

The solution seems to be to set a reference to the .exe instead of the projectfile. However we ran into some trouble with that also - a better solution is on it’s way…

Read More