No color coding for Classic ASP in Visual Studio 2008

This seems to be a bummer. Color coding and intellisense for VBScript code in Classic ASP pages have been deprecated in VS 2008.

There is a workaround for making it work for files with the .vbs extension but no solution for .asp pages. Hopefully someone would come up with a hack to get it working again.

Until then Microsoft’s answer is for us to use VS 2005 or Visual Web Developer 2005. But don’t install VWD if you already have VS 2008 installed since VWD will take over all file associations leaving 2008 broken.

You can let Microsoft know how much this sucks by ranting here: http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=290845

No color coding for Classic ASP in Visual Studio 2008

Moq: Linq to Mock

Daniel Cazzulino just announced the birth of Moq, now this is mocking done right.

 

// ShouldExpectCallWithArgument
var mock = new Mock<IFoo>();

mock.Expect(x => x.DoInt(1)).Returns(11);
mock
.Expect(x => x.DoInt(2)).Returns(22);

Assert.AreEqual(11, mock.Instance.DoInt(1));
Assert.AreEqual(22, mock.Instance.DoInt(2));

 

Lambda is starting to make my mouth water.

Moq: Linq to Mock

The Dangers of Static Events In User Controls

Static events in user controls can lead to all sorts of weird behavior in your application. Especially when they are hosted in forms that are loaded and unloaded during the lifetime of your application.

public partial class FlexiAddress : UserControl
{
    public static event EventHandler<AddressChangedEventArgs> EventAddressChanged; 

The danger here is that unless you unhook from the static event before your form closes what happens is that although the form is not visible it still hangs around in memory until your application exits.

So if you are showing the form by creating a new instance, every form that is created is loaded into memory and will actually cause a memory leak.

If you want to prove this to yourself the easiest way is to include a Debug.WriteLine in the even handler and then after you’ve opened and closed the hosting form a couple of times try to do an action that causes the event to be fired. You’ll notice that the Output window has one line for each instance of the form that is loaded in memory.

The solution, is to remove the hook to the event handler, the Form_Closing event is probably a good place to include this.

AddressControl.EventAddressChanged -= AddressControl_EventAddressChanged;

The better solution though is to avoid using static events.

The Dangers of Static Events In User Controls

Visual Studio 2008 TFS breaking Unit Test Projects

On the next iteration of my current we’ll be using Visual Studio 2008 and targeting .NET 3.5.

As usual I jumped the gun and installed it before the rest of the team, so I had to keep VS 2005 running at the same time. Everything was hunky dory until I installed the TFS 2008 client. This somehow caused the unit test projects to be disconnected from the TFS server. You could check out and check in stuff from the Team Explorer but the projects were showing up as disconnected from the Solution Explorer.

To get out of this mess I had to uninstall both 2005 and 2008 Team Explorer and then reinstall Team Explorer 2005.

Visual Studio 2008 TFS breaking Unit Test Projects

My First Post…

Wow, it’s been more than a month since my last post from Sri Lanka. Life has been quite busy and I’ve been overwhelmed sometimes, but things are slowly falling into place.

After getting to Australia, my first biggest challenge was to find a place to rent. The renting system in Australia is well organized but its extremely difficult for someone who doesn’t have a rental reference to get a place. I was lucky, on of my friend’s friend called Priyasha drove us around on our first weekend and we ended up being able to just look at one house. As luck would have it no one else applied for the house and we finally got it.

The second challenge was to buy a car. Since my first assignment is at Microsoft Australia’s SDC (Software Development Centre), I had to get a car since the public transport up there was not too good. Again Priyasha came to my rescue and we ended up buying the last car we saw that day. The car although old is in much better condition than the one I sold off in Sri Lanka and it cost me only $2,750.

We moved in the week before last and had to go around buying all the stuff for the house. I ended up getting just the minimal stuff like the fridge, washing machine, microwave. It’s quite a blur, considering that I spent over a year buying all the household items and that too after doing a lot of research on each item. But here it took us a couple of hours to pick all of the items from the Good Guys store.

Plus when you move into a new house you need to do whole lot of things like getting a telephone line, electricity line, gas line, but since I could do all that over the phone it was quite pain free. I’ve applied for a broadband line which should be hooked up by next week.

My First Post…