How to get out of syntax highlighting in VB.NET

One of the most annoying thing with VB.NET is when it tries to help you with syntax highlighting, when using snippets.

You know; you type “property” hit TAB and then the property is created for you. The things that you needs to “fill out” is highlighted with some scary green color (see picture above).

In Visual Studio:

  • After the snippet is filled out position the cursor after end property
  • Hit ENTER
  • The green coloring is gone

If anyone know how to do this in Visual Studio 2005 I would love to know. I’ll buy you a cup of coffee at Länsförsäkringar, level 4. I promise

Read More

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

The previous post about CLS-compliant classes is right in a way but the real answer lies in that when you create a test project with Visual Studio, the created Assembly is marked as CLS-compliant.

This is done in the AssemblyInfo.vb (or .cs depending on your choice). I am not quite sure on why this is done but can imagine that it has to do with that the test project wants to be open for calls on all lot of different classes and components.

However in our case we only had to remove the CLSCompliant(true) from the AssemblyInfo.vb-file and everything was back to normal.

Read More

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 co-driver…

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 Solution Explorer

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