Blog Archives

An Error of Judgement

I recently came to work and found that I had unwittingly coded a bizarre occurrence.  Unsure as to how I came across it, but thankfully it was spotted while I am still developing the solution.


The above error came as a result of this, this isn’t the error I saw in my application before spotting it, thankfully I spotted it before I built and test run the code.  But using a demo, this is the error I got, just to show you the result of this.  Below is the code that causes this;

class Program
	static void Main(string[] args)
		TestClass tempClass = new TestClass();

public class TestClass
	public int Id { get; set; }
	public string Name { get; set; }

	public TestClass()

	public void LoadData()
		for (int i = 0; i < 10; i++)
			TestClass tempItem = new TestClass();
			tempItem.Id = i;
			tempitem.Name = string.Format("My Name - {0}", i);

It might not be completely obvious but there is an infinite loop there.  Not in the traditional sense which is why it might not seem too obvious.  In the Constructor of TestClass I call the method LoadData.  In which I create a new instance of TestClass, which them again calls LoadData and so on.

Like I said not your typical infinite loop;

while (true)

Like above we can see that is will not exit this loop, but this one, will just cause the application to hang there.  The other ran into an error but the error, though correct might have you going down the wrong path.  Suffice to say I have fixed this, called the LoadData from the code path that creates the instance of the data, and the constructor is now empty.

Sometimes as programmers you have dumb moments, thankfully it got caught before it gets put into a production environment.


The Visual Studio Express

I am adding this more for a reference, Microsoft has done a wonderful job in releasing the Express products.  From version 2005 when they first appeared to now with the release of 2012, they have added and continually tweaked the inclusion list of what is available within the Express editions.  So I will provide a list of the express products, a link to download them and also provide additional links for products that can be used with that version of the product.

A point of soreness I have with the express editions is the lack of source control support.  2012 now includes it, and also includes a free edition of Team Foundation Server (up to 5 users), which has also be reduced in functionality from the full version.

Name   2005 2008 2008 R2 2010 2012
Visual Basic   Visual Basic 2005 Express This uses the Web Platform Installer to install the components needed.  This requires a connection to the internet during the installation.   This uses the Web Platform Installer to install the components needed.  This requires a connection to the internet during the installation.  
Visual C#   check This uses the Web Platform Installer to install the components needed.  This requires a connection to the internet during the installation.   This uses the Web Platform Installer to install the components needed.  This requires a connection to the internet during the installation.  
Visual C++   check This uses the Web Platform Installer.  This requires a constant connection to the internet while installing.   This uses the Web Platform Installer to install the components needed.  This requires a connection to the internet during the installation.  
Visual Web Developer ^   check This uses the Web Platform Installer to install the components needed.  This requires a connection to the internet during the installation.   This uses the Web Platform Installer to install the components needed.  This requires a connection to the internet during the installation. ISO.  Web Platform Installer option is available.
Windows Phone         This uses the Web Platform Installer to install the components needed.  This requires a connection to the internet during the installation.

Visual Studio 2012 does not support Windows Phone.  This is coming soon.$

Game Studio Express Game Studio Express v1.0 was released for the C# 2005 Express verison only.          
SQL Server   SQL Server 2005 Express edition is available without the Advanced Services as a separate download. SQL Server 2008 Express, links to all the services for the express editions. SQL Server 2008 R2 Express Edition is a complete setup and has all advanced services in the package.   Contains all downloads for all Express options for SQL Server 2012 Express.
Visual Studio*     This is the ISO version of all products.  

Visual Studio 2010 Exress doesn't include Visual Studio 2010 for Windows Phone.**

ISO.  Web Platform Installer option is available.
Team Foundation Server           ISO.  Web Platform Installer option is available.
Windows 8           ISO, but a Web Platform Installation is available.
Visual J#  

Visual J# is not release within the Visual Studio suite of products.  It is supported till approx 2015 in the 2005 release.#

Visual F#    

F# CTP is the only version available for Visual Studio 2008 integration.  But it contains a compiler that will work without the need for additional software.&

  Visual F# for installation into the Visual Studio 2010 Shell. You will need to install Visual Studio Express 2012 for Web prior, or the Web Platform Installer will do this for you.

Confused yet.   There is a lot to take in, especially if you are wanting to develop for Windows Phone and Windows 8.  2 versions, for the moment.  But that said, and despite the fact that the earlier versions are split into separate products I will try and explain a little more about what you can or can’t do with these express editions.

Note If you purchase the Professional edition or higher, these will include the full set of tools that is covered by the express editions.  The exception is current Visual Studio 2012 and Windows Phone.

With each new version of the of the products they increased what was available.  I will not go through each one, since there is a significant difference not only between the express editions and professional but also within the express editions on a version.

With the 2005 express editions, there were a couple of significant differences.  The main one was to do with the difference between Web Developer and the language versions.  The Web Developer could never create class libraries.  This wasn’t a huge deal since you could create them in the language version of the product.  This was fixed in the 2008 express editions.

Macros, these have not been a part of the express editions for sometime.  And from my understanding of it, will remain to be a key difference between the express editions over the full product.  This also goes for add-ins, though in 2012 I believe there is an exception for this, and I need to confirm this, but Team Foundation Server Express can be integrated into the Visual Studio 2012 Express editions.  As to other source control applications are supported, or the full version of TFS I do not know.  I will provide an update.

The note on Source Control.  All previous version from 2012 could not use integrated source control, this was possibly due to the restriction on add-ins and extensibility as the source control integration is such a tool.  You could still use a source control application but you needed to use it externally.

Why Express

I would say one simple reason, they are free.  When you are learning how to program the tasks is daunting enough without the need to worry about the cost of the development environment, not to mention, that if you learn and find that it isn’t for you, which is possible, then you have dropped a wad of cash just to try.

The later versions are better, not needing to install different versions if you want C#, C++ and VB, but Microsoft have been improving each version of the express edition with each release.

XNA Game Studio

You might see that XNA Game Studio hasn’t been listed here, and since I am using it at home, I possibly should have. But the subsequent versions haven’t been labelled express.  Then neither has F#, but F# is a language, XNA is an additional set of libraries and templates.

XNA Game Studio Express Original release This version requires Visual C# Express edition t
XNA Game Studio 2.0 2005 XNA Game Studio 2.0 now supports all proudcts of the Visual Studio 2005 suite.
XNA Game Studio 3.0 2008 download
XNA Game Studio 3.1 2008 3.1 contains some extras over 3.0 including Avatars, LIVE Party support and other enhancements.
XNA Game Studio 4.0 2010 4.0 is for use with Windows Phone as well.

Currently there is no word on the release of XNA Game Studio 5.0 (if there is one) and its use in Visual Studio 2012.  Thankfully there is a way of developing XNA applications using Visual Studio 2012.  But some of the official words are, since XNA is not supported as part of the WinRT (therefore Windows App store applications) are not supported.  XNA, as mentioned before will still work with Windows 8 Desktop (as this operates like Windows 7).

Since XNA originally was a way for users to create games on Windows and then the Xbox 360 a lot of XNA is reliant upon DirectX 9.  There is nothing to stop Microsoft from releasing a DirectX 11 version of it, but at the moment, as Xbox 360 uses a model of DirectX 9 this will not happen soon.

Games can be made using C# and DirectX with the Windows 8 express edition but this is the method I believe they are heading towards at this stage.

Windows Phone 8

I am unable to say too much about Windows Phone 8, what is coming, available in any express edition like Windows Phone 7.  But you can sign up for early access to the beta program.  You will need to have a development Id for the current Windows Phone Store and I believe also some details regarding an application that exists.  But the details for this are available on the Microsoft Connect site, sign in with your Live Id and I believe most of it will be ready to go the rest is up to you.

The reason for a lot of this I believe is, Microsoft has kept the details regarding Windows Phone 8 largely secret.  At TechEd 2012 there were people who knew, but they were no divulging anything at this time and the Beta program also has some non-disclosure agreements within, so be warned.

SQL Server

This was in some ways a massive boon to the student or hobby developer, using a near full implementation of SQL Server as a database platform.  What is there not to like?  Well I am unable to think about too many reasons why I would not go SQL Server any other RDBMS, but there might be reasons not to use the version of SQL Server.

Personally, if I know I need a database and it is going to be a small single user database, then I will use Microsoft Access.  This might cause a groan from the crowd, but I will justify it.  Microsoft Access has come a long way from the humble beginnings of Version 2.  My first programming job was to convert a constantly corrupting MS Access 2.0 database to SQL Server 6.5.  No easy feat, but in the end I got there.  But I did qualify my statement by saying a single user and it is small, then Access is better, I will even go as far as say a few users as well.  Beyond that, SQL Express is better by far, and it is more to do with the way data is handled internally of the DBMS, Access is a file, calls are read on disk passed back.  SQL though is similar, there is an engine that controls the data access, it is using execution plans to speed up data access, caching of regularly used data and so on.

All of these additions though include an overhead, a decent overhead too.  To gain the performance benefit of SQL it needs memory and if you aren’t careful it can use a lot of it.  If SQL isn’t using it, it will give it back, but it is confusing when looking at how much memory the system is using.

The restrictions are largely to do with hardware, amount of memory, database size, number of users connecting.  Just bare this in mind when building applications using SQL Server express, large databases use more memory, or require more memory to function efficiently and there might be a degradation of performance if the upper limits of the hardware specifications is reached.

  2005 2008 2008 R2 and higher
DB Size (excludes logs) 4GB 4GB 10GB
SQL Agent No No No
CPU Single CPU Single CPU Single CPU

DB Size is per database not database server.  This doesn’t include the log file in the size.

A single physical CPU is the only option but this excludes multi-core CPUs.  The express editions enables this use of multi-core CPUs, but there can only be 1 physical CPU.

The RAM restriction is only to the amount of RAM SQL Server will use and not that of the machine.

So, baring these restrictions in mind then go for it.


F# has been released officially with Visual Studio 2010, but also with Visual Studio 2012.  There is no specific Express edition but I have provided the links that will enable the use of F# within a Shell product, which is in essence Visual Studio Express editions provide.


Microsoft has been incredibly generous to developers now days.  Development tools back in yore was using notepad and getting a compiler and linker somewhere.  The use of the IDEs now days makes this easier than before, not to mention, these express editions, I don’t think anyone can or should complain about what is missing when there is the best IDE in the development world, period.  A compiler for languages thus far, a few exceptions, which enables one to write, Windows, Web, Games, Data and all manner of applications, yes there are restrictions, but since the .NET framework offers the full functionality there is often ways around this.

If you have never learnt programming before, then now is the best time to jump in, VB is a great starter as it has always been, C# is a great step up and certainly now C# and VB are closer than ever.  C++ gives you a fully compliant C++ compiler, install the DirectX SDK and there is nothing stopping you creating a AAA game, other than money.  With these editions, you only need to use them for what you can do.  When you feel you need more, then upgrade, but if they serve your purpose then is there a need.


Well I have put as much information as I could for the moment, I am sure if I tried I could keep going.  I was able to find the links to the 2005 and 2008 editions, while they are still available.  I am sorry if you go here and find that the links do not work.  Contact me and I can update them.

Why would I put up the 2005 and 2008 editions, compatibility.  Though the predominate OS is Windows XP, and Visual Studio 2010 can run on XP but you need a decent machine with a decent amount of RAM to run VS2010 nicely.  So, the 2008 and 2005 versions are a good place to start on older hardware.

But since I have give all of these express editions and since I am writing a site dedicated to games and development I would be remiss if I left out some links so you can create that next great AAA title.


DirectX Software Development Kit

  This version is for use in Visual Studio 2008 and 2010.  It talks about it is not supported.  This is possibly due to certain components that need the IDE.  If this is an issue, you can download the previous release of the SDK from here.


Microsoft Windows SDK for Windows 7 and .NET Framework 4

  This is the latest version of the Windows SDK, it supports the latest supported versions of Windows (so anything lower than Windows XP SP3 is excluded).  This is a web installer of the product as this is a very large download.  There is also an ISO available here.

Both of the versions of the DirectX SDK support DirectX 11 as was released in Windows 7.  The latest version includes some improvements and as well as some new features for DirectX 11 and improvements for the HLSL (High Level Shader Language).

So I hope this helps, if you need more information drop me a message or contact me directly.  Will be happy to help.

  • * Visual Studio 2012 Express is called Express for Windows Desktop which includes C#, C++ and VB.
  • ^ Visual Web Developer for 2012 is called Express for Web.
  • ** Visual Studio 2010 Express does not include Visual Studio 2010 Express for Windows Phone.
  • $ Visual Studio 2012 current doesn’t support Windows Phone, Windows Phone 7 and 7.1 development needs to be done on Visual Studio 2010.
  • & Visual F# is in the list for completeness as it comes as a separate download, from all information I have read, it can be installed into a Visual Studio 2008 shell and 2010 shell, which will then enable the use of the F# language within the IDE.  There is a 2012 shell.
  • # Visual J# is not longer an available product as part of the Visual Studio suite.  It is available as part of Visual Studio 2005, include Visual J# 2005 Express, and will be supported until sometime in 2015.  See Visual J# on MSDN for more information.

Visual Basic and Escaped Characters

I really like C#.  I have programmed in it personally, doing the games development course in it, also doing it commercially having developed web sites and updating tools and utilities written in C#.  But despite my first programming languages being x86 Assembly and Pascal I feel that my heart will lie with Visual Basic.  Since my best friend Phippsy, showed me VB3 back in the days, it has been a memorable journey from baby steps to the more advanced by claiming my MCSD in VB6.

So where am I going in this nostalgic post.  Well it is about strings and escaped characters within the string.  C, C++ and C# and I believe Java and others have enjoyed the maintainability of using escaped characters within a string to denote an unprintable character.  The most common of these is the \n (new line).

I have found that despite the many changes in the language over the years, the implementation of classes, expanding OO to not quite OO and then the full implementation of OO with .NET.  Then the progressions of the language within .NET even seeing some features in VB getting adopted by C#.  But escaped characters in the string is still not there.  Not sure why, I can only guess and I am not wanting to.

So, where does that leave us in the world of VB.  Continuing to use the concatenation operator &.  Or trying something different, which is what I am going to describe here.  There are 2 methods that are usable and very viable as an option within VB.

Traditional Method

Dim strMessage As String
strMessage = "This is a message." & vbCrLf & "Separated by a new line."

This would be a common view for many VB programmers.

String.Format Method

Well this is the first of the different ways.  Now there is nothing revolutionary about these methods, other than they might not be ways you have thought of and continue to use the above traditional method to add new lines and other non-printable characters to a string.

Dim strMessage As String
 strMessage = String.Format("This is a message.{0}Separated by a new line.", vbCrLf)

Please disregard the fact that I would put this all onto one line.  But I was trying to highlight the differences in each.  It is longer, but to me, this string, that is the characters enclosed by the quotes is more readable, this increases substantially when there is more than one of these.

See String.Format

Regex.Unescape Method

This one seems a little obscure, but works in a manner to which C users (all forms) are accustom to and if you have come from that environment into VB, this might be the preferred method.

There is one downside to this, the importing of a new namespace.  But fear not, this will not bloat things, or slow your code to snail like proportions but it is something to be aware of is this is new code that will be loaded and JITed which does take a hit.  I will include the imports statement into the code, just for completeness.

Imports System.Text.RegularExpressions

Dim strMessage As String
strMessage = RegEx.Unescape("This is a message.\nSeparated by a new line.")

There is it, the \n just like in C.  And this is what this unescape method does, it “Unescapes any escaped characters in the input string.”

See Regex.Unescape

C# Just for Comparison

When one looks at the three, it is easy to see the virtues in using escaped characters within the string.  Though, I am in still two minds about using them.  Why, well in so many ways, it is not something I am used to.  Having developed possibly hundreds of thousands of lines of code in VB, old habits are hard to break.  But, are there benefits to the new methods, maintenance.  Having new people coming in, looking at the code and understanding what it is doing, especially if they have come from a C environment previously.

string strMessage;
 strMessage = "This is a message.\nSeparated by a new line.";

P.S.  Please forgive the code posting.  I am using Windows Live Writer, and I have been trying different code plug-ins for it to enable me to enter my code into the writer and post it on the blog.  Provide some differences in the look of it to signify that it is code, but also to make these elements easier to read.

There are a few of them, that makes the code look great in the Preview page, but when it comes time to post it, somehow it is mangled and I don’t have the time to work out why it has failed to make them look the same.

P.P.S.  I have updated this post and I have fixed the code blocks.  I will now go back and update all of my previous postings that have code in them.  Sorry for this.