Sunday, February 28, 2010

[ Application Tier ] TF255437: An error occured while querying the Windows Management Instrumentation (WMI) interface on the following computer:

You may have received the following error messsage while processing the Readiness checks during the installation of TFS 2010 CTP recently: [Application Tier] TF255437: An error occured while querying the Windows Management Instrumentation (WMI) interface on the following computer:. The following error message was received: Invalid Namespace.

So I though I'd check that WMI Service is running, and it was. After searching around it turns out I needed to enable WMI Compatibility for IIS 6 under IIS. You can enable this under Server Manager in Server 2008 and change the IIS role.

I think this 'feature' has been fixed for RTM of TFS 2010.

Friday, February 19, 2010

How to find out when your pre-release version of Windows 7 will expire

If you are still running pre-release Windows 7 OS like I am, it will expire soon. So how do you find out when it expires? Simple run winver.exe on the run menu and you'll get this. My copy expires on 1st March 2010.



Zune HD software for x64 platforms

Don't make the same mistake as I did in downloading the x86 version of Zune if you run x64 version of Windows.

Get the x64 version here: http://www.microsoft.com/downloads/details.aspx?FamilyID=9d25c2a6-cae3-49b0-a474-124fe79628a8&displaylang=en

Note: The x64 version is ~400mb where as the x86 is ~50mb !

Preview of Windows phone 7 Series

Thursday, February 18, 2010

It's Windows phone 7 Series time at MIX this year

It's no secret that MIX will be covering a lot of the Windows phone 7 Series content this year in Las Vegas (March 15th - 17th).

I just wish I was going, perhaps if I can find a cheap flight.....

Note: Windows phone sessions to be confirmed...

http://live.visitmix.com/

Wednesday, February 17, 2010

Implementing the CommonServiceLocator on the Compact Framework

You may have come across or used the CommonServiceLocator API as developed by the p&p team at Microsoft for your desktop applications in the past.

Before we go any further, it is worth explaining what a Service Locator is. The Service Locator is a pattern that abstracts your retriveal of components or services from the underlying container model that is used to house them.

So no matter what container you use, i.e. Castle Windsor, Spring, StructureMap etc pulling anything from the container in code will always be the same and consistent across layers.

Martin Fowler explains it better than I can here: http://www.martinfowler.com/articles/injection.html

All you have to do is write an implementor for the Service Locator to use. You'll note all the famous ones on the site above have already been implemented. But of course these don't work on the CF, so what do we do?

Firstly, you need to download the source code for the CommonServiceLocator as the project needs to be modified slightly. Simply remove all references to the ActivationException.Desktop class as the constructors in that class are not supported on the CF. That is it! - for the service locator project. Now all that remains is the implementor. This depends on what container you are using. We have been using a container called CompactContainer written by Germán Schuager that works well (uses reflection as it supports true dependency injection).

CompactContainer can be downloaded from here: http://code.google.com/p/compactcontainer/ it is freely available under the Apache Licence.

In order to write an implementor for the CommonServiceLocator, all you need to do is write a class that derives from abstract class ServiceLocatorImplBase, then tell the service locator where the instance of the container is and a reference to itself. This class implements IServiceLocator too, so itself can be injected into classes - for whatever reason.

The class is really simple, it could look something like this, here we have named it CompactServiceLocator:

public class CompactServiceLocator : ServiceLocatorImplBase
{
private readonly IContainer _compactContainer;
private bool _disposed;
public CompactServiceLocator(IContainer compactContainer)
{
_compactContainer = compactContainer;
}


protected override object DoGetInstance(Type serviceType, string key)
{
object resolvedObject = null;

// Resolve using a key if we have a key
if (!key.IsNull())
{
resolvedObject = _compactContainer.Resolve(key);
}

// Resolve using type if the object has not been resolved
if(resolvedObject == null && !serviceType.IsNull())
{
resolvedObject = _compactContainer.Resolve(serviceType);
}

return resolvedObject;
}

protected override IEnumerable<object>
DoGetAllInstances(Type serviceType)
{
return _compactContainer.GetServices(serviceType);
}

private void Dispose(bool disposing)
{
if (!_disposed)
{
if (disposing)
{
_compactContainer.Dispose();
}
_disposed = true;
}
}

public override void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}

}
So essentially the above code is fairly simple in that all it is doing is it allows the service locator to call your specific container method. i.e. the implementation of method DoGetInstance() calls the specific container method to get an instance from the container. In this case it is method Resolve(). It is just implementation specific code which will look different from container to container.

So now you have written an implementor to go along side the Castle Windsor etc adapters, how do you use it? Well first you have to tell the Service Locator the container instance it should use, then set a reference to the service locator interface that maps to itself, like so:
Container container = new Container();
ServiceLocator.SetLocatorProvider(() => new CompactServiceLocator(container));
container.AddComponentInstance<IServiceLocator>(ServiceLocator.Current);
Container in this case is the CompactContainer freely available as mentioned above.

Asking for services is done as follows:
ServiceLocator.Current.GetInstance<IFooBar>();
Where IFooBar is your registered interface on the container.

That is it - as easy as that. If anyone would like me to put together a complete solution demoing this, please let me know. I didn't do it as the code is all available on line apart from the CompactContainer ServiceLocator implementor.

Windows Mobile 6.5.3 Developer Toolkit Released

You may have noticed that the Windows Mobile 6.5.3 SDK was released two weeks ago for 1 day then pulled from MSDN. I don't think Microsoft has made a public announcement why this was, but it is back under a new name. The 6.5.3 Developer Toolkit was uploaded today and can be downloaded from here:

http://www.microsoft.com/downloads/details.aspx?FamilyID=c0213f68-2e01-4e5c-a8b2-35e081dcf1ca&displaylang=en

Of course be sure to change your target project type within Visual Studio to make use of the new emulators.

Tuesday, February 16, 2010

Windows Phone 7 Series Announced at MWC



You've probably heard by now that Microsoft has announced Windows Phone 7 Series to the community on 15 Feb at the Mobile World Congress conference in Barcelona by Steve Ballmer. The Microsoft official press release can be found here.

I have to say the platform looks awesome. It looks very Zune HD like which is partly to do with the fact that Joe Belfiore is on the design team.

The best publicly available video to date that shows the platform UX is over on channel9 here:
http://channel9.msdn.com/posts/LauraFoy/First-Look-Windows-Phone-7-Series-Hands-on-Demo/

Dev Story:
If you're expecting to hear about the developer story or anything to do with the application platform then you'll be disappointed. Microsoft has not made any thing public regarding tools, frameworks etc for the new wave of Windows Phone 7 Series products. Microsoft is gearing up to tell the community about the developer story at MIX in Las Vegas on March 15-17. For sessions on Windows Phone 7 Series at this event see here.

For developer story announcements keep an eye on Charlie Kindels' blog as he is responsible for the Windows Phone 7 Series application platform.

The Windows team blog has a post on the announcement here.

The Windows Phone twitter hashtag is: #wm7

In Seattle at Summit



So it's that time of year again, I'm at the MVP Summit 2010 this year and looking forward to it as there are many new and exciting technologies being released out of Redmond.

I will post the stuff I can here.