Saturday, October 30, 2010

Free Not For Resale MSDN Subscription up for grabs!!

I have in my possession a Not For Resale Visual Studio 2010 Ultimate with MSDN Subscription, and it's up for grabs. Like all other Microsoft MVPs I had 3 to give away, I have given away 2 already but now I have just 1 left.

So I can't think who to give it to as the two lucky people that received this free subscription were the only ones that I know of who wanted to get into programming or wanted to move to Visual Studio 2010 and the 2010 wave of Microsoft products. Most of the people I know receive Visual Studio 2010 as part of their corporate MSDN licence provided by the company they work for.

I thought about who to give this to and I couldn't really think of anyone that I thought really derserves it. So instead I took an idea from what some other MVPs have been doing and that is to present a challenge to the community and the best or the right answer wins the MSDN subscription! That's fair don't you think...

The Challenge

As I am passionate about Technical Architecture and good clean code and the fact I have done lots of code reviews in my career, I thought the challenge could be around best coding practice or the best example of clean maintainable easy to understand code.

So the challenge is really: write an application for the new Windows Phone 7 Series device using the new free tools (Visual Studio 2010 Express with Windows Phone 7 Series) that promotes good architectural design.

The things I'm looking for and this will greatly increase your chance of winning are as follows:

  1. Good OO, pay attention to the single responsibility principle. No procedural code
  2. Code must be maintainable
  3. Easy to understand
  4. Good system design patterns such as, command, MVVM, MVP, repository etc
  5. Good code coverage (doesn't need to be 100%) but if used will make achieving 1, 2 and 3 on this list a lot more likely
  6. You'll get extra marks if you make use of the IoC container I checked in to codeplex: - note that project is targeting the Beta tools of Windows Phone 7, I haven't got round to updating it yet but it should work with the RTM release of Windows phone

So..... the ultimate question you're probably asking is, what application should you write? well it doesn't matter. It could be an application as simple as a calculator to something that makes use of networking or Windows Azure for example. The person that wins this will be win it based on good architecture code design.

You've got until Tue 26th November to get something to me to review. Then I'll announce the winner before the end of November. The subscription does expire soon which is why I'm only giving about 3-4 weeks to do this.

Send submissions to simon (at) simonrhart (dot) com. If you have any questions then leave a comment on this post.

Happy coding!!

Friday, October 22, 2010

TFS 2010 Backup Power Tool - Grant Backup Plan Permission Failed

Now that TFS Power Tools has been released we can take advantage of the Team Foundation Server Backup feature that makes backing up TFS so much easier than it used to be.

The TFS Power Tools contain tools client side too, it's just the backup feature is designed to actually run on the TFS server itself.

It supports backing up not only all your collections but also your Reporting Server database (if using SQL Server Reporting Services integration) and your SharePoint databases if using MOSS for enhanced reporting. It works very much like the standard Windows Server Backup utility that is shipped with Windows Server 2008 R2.

You have an option specify how many copies of the backup to keep. You have to backup to a network location. You can't backup to local disk like you can with Windows Server Backup. This tool is designed to worry about backing up TFS so you don't have to.

The tool integrates with the Team Foundation Server Administration Console. So you create a backup plan from within there. You can specify when the backup should run i.e. daily, weekly, time of day etc. It can run under a domain or local account to.

There are a few articles out there that step you through the process of setting this up so I'm not going to do it here. Instead I came across a nice "issue" with it when setting it up that I thought might save other people time as I burnt quite a bit of time on this. Here is a very good example of this:

So my issue was when getting to the end the readiness checks were failing with the Grant Backup Plan Permissions step. Which was weird as I had write access to the UNC path to which the backup was writing. The other strange thing was I discovered a file in the UNC path after running this readiness check.

After investigating further and looking at the log file (snip copied here) I figured out what was wrong:
Error  @15:35:29.014] System.UnauthorizedAccessException: Access to the path '\\server\backup\TFSBackups\Tfs_Configuration_20101022163528.bak' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.Delete(String path)
at Microsoft.TeamFoundation.PowerTools.Admin.Helpers.BackupFactory.TestBackupCreation(String path)
[Error @15:35:29.060] !Verify Error!: Account DOMAIN\user failed to create backups using path \\server\backup\TFSBackups
[Info @15:35:29.060] "Verify: Grant Backup Plan Permissions\Root\VerifyDummyBackupCreation(VerifyTestBackupCreatedSuccessfully): Exiting Verification with state Completed and result Error"
[Info @15:35:29.060] !Verify Result!: 5 Completed, 0 Skipped: 4 Success, 1 Errors, 0 Warnings
Notice what it is doing yet!? It basically writes a file to the UNC path to check for write permissions - BUT not as the service account, it uses the current logged on user account (this is a bug I'm sure). But what is failing is actually the deletion of the file.

Because of this the readiness checks fail and you can't continue. After looking at the permissions (or should I say IT looking at the permissions) it turns out I didn't have Delete permission for the current logged on user for that UNC path. Once setting the Delete permission to true, the problem went away and now I have a successful backup plan in place!

Tuesday, October 19, 2010

Power up failed (vrc=VERR_VMX_MSR_LOCKED_OR_DISABLED, rc=E_FAIL (0X80004005))

I recently tried to use VirtualBox to run a Virtual Machine on my new laptop which is a HP EliteBook 8530w. But after attempting to start the VM I encountered the following error: Power up failed (vrc=VERR_VMX_MSR_LOCKED_OR_DISABLED, rc=E_FAIL (0X80004005))

So as per the return code, this is telling me that VT-x is either locked or not enabled. It can't be locked as this is running on Windows 7 which does not have any other virtualizer running, i.e. VirtualPC or Hyper-V. It is enabled as I explicitly set virtualization in the BIOS. It turns out that I needed to also enable Txt Technology. Once Txt Technology was enabled, the VM fire-up! nice

I am not normally a VM person, but my new laptop is a beast. 8Gb of RAM so I can allocate 4Gb to the VM and it runs like a host OS.

Monday, October 18, 2010

The File AssemblyInfo.Cs could not be found within the project templates. Continuing to run, but the resulting project may not build properly.

Today after installing Visual Studio 2010 on a fresh copy of Windows 7 Enterprise, I encountered the following error message whenever I tried to create a new project using any project template: The File AssemblyInfo.Cs could not be found within the project templates. Continuing to run, but the resulting project may not build properly.

I think this may be due to the fact I accidentally installed a pre-release version of ReSharper 5.1 (I was meant to install the RTM version). Even after uninstalling ReSharper the problem did not go away.

To fix the issue, I simply ran this trusty old command: devenv.exe /InstallVSTemplates

Job done.

Saturday, October 16, 2010

Arrow and Enter keys stop working in Visual Studio 2010

I found this issue with the RTM of Visual Studio 2010 recently where the arrow keys and the Enter key do not work as expected. This is a show-stopper as you can't write any code, or rather you can, you just have to write everything on 1 line!

I have 3 machines with VS 2010 installed. Each machine is fairly similar in configuration. I have only encountered this issue with 1 of those 3 machines - which makes it very hard to diagnose.

In my scenario I found the some of the arrow keys - the up key for example was acting like a tab within the code window. It would when pressed allow me to set focus on the combo box that contains classes the the current namespace.

Other people have received this issue, but the work around for them is to simply close and reload VS. In my case this didn't work. I even uninstalled all of the VS 2010 bits including the framework to no avail. This problem affected all SKU's of Visual Studio 2010 (only 2010, 2008 worked fine for me).

I should mention VS 2010 RTM used to work on this troubled machine. It must of been something I installed or configuration I changed later. I tried rolling my machine back to when I think it was working, again to no avail.

There is a bug report on Microsoft Connect here:

So if you have experienced this, make sure you vote on the link above, or if you found a work around please leave a comment.

This may of been due to the fact I installed RC and beta copies of VS - as I installed pre-release copies of Windows Phone 7 developer tools. Then I installed the RM version of VS 2010 after uninstalled the pre-release versions as per the release notes.


I failed to figure out what was causing this. If I had the source code of course I could debug VS but as I don't, it was down to trial and error. I had no logging written to the event log. VS never crashed as a result of this, it is just a very annoying bug that I could not figure out what caused it.

So in the end, I had to reinstall Windows, and now.....I have VS 2010 working again!

Thursday, October 14, 2010

DiscoverServices : Failure in find service API calls : Can't find PInvoke DLL 'BTInterface.dll'.

I have been coding against the new Motorola MC65 and the Motorola ES400 - devices that will port onto the new Windows Embedded Handheld when released later this year.

I was attempting to pair with an embedded bluetooth device using the EMDK v2.3 - an EMDK that has worked on previous Motorola devices such as the MC75.

When attempting to pair using the Symbol.WPAN.Bluetooth.Bluetooth class, the device receives the pair message but then the EMDK throws ab Exception with message "DiscoverServices : Failure in find service API calls : Can't find PInvoke DLL 'BTInterface.dll'."

The stack trace looks like this:
   at ag.l(RemoteDevice A_0)
at ag.n(RemoteDevice A_0)
at ag.j(RemoteDevice A_0)
at Symbol.WPAN.Bluetooth.RemoteDevice.Pair(String AuthenticationPIN)

I can confirm, once upgrading to the latest version of the EMDK v2.4 fixes this issue (v2.04 of the Symbol.WPAN.dll assembly).

You can download the EMDK v2.4 for .NET here:

Friday, October 01, 2010

Microsoft MVP Award 4th year in a row!

I have just received the 2010 Microsoft MVP Award in Device Application Development. This is my 4th MVP award in a row and it's an honour to be in the programme for another year.

Thanks Microsoft!