Nick's .NET Travels

Continually looking for the yellow brick road so I can catch me a wizard....

Small Features are Cool Too!

This evening I was taking a look at some of the additional options in the Project Properties dialog in Visual Studio 2008 Beta 2 and noticed that there was an additional dropdown on the Resources page.  The Access Modifier dropdown with options Friend and Public (in conflict with the documentation which states there should also be a No code generation option) allows you to control the accessibility of the project resources.


So, how does this look in practice?  Well, assume that this TestResource string resource is defined in a project called ReferencedLibrary. Now to access this resource from within this assembly you would write:


To access this resource from another assembly that references this project you would write:


This option requires the Access Modifier property to be set to Public. Not sure if I agree with access modifiers for resources being set at a project level - think I would prefer to see this property set on  a resource by resource basis but hey, this is a small but cool improvement!

More Behavioural Change

By chance I was walking through Crows Nest on Saturday when I noticed what initially looked like a graffitied wall (I've only added the red ellipse):

behavioural change

Although my initial reaction was to keep on walking - honestly, can these guys be serious with a wall painted like that? - but then I noticed the "Driving Behavioural Change" point.  If we look at what Behavioural Intelligence is, over and above traditional Business Intelligence, it is all about instigating and supporting (aka driving) behavioural change within an organisation. 

When I returned home I thought I'd take a look at Change Drivers and sure enough their slogan is "Systems make it possible - people make it happen".  The most important asset in nearly any organisation are the people that run the business.  They are also the most complex of all assets, both financially and operationally, making them the hardest to manage.  Further, unlike machinery, you actually need to motivate them and keep them engaged in the business.  Behavioural Intelligence is more than giving employees the tools to do their job, it's about the provision of accurate and timely information.   This subsequently removes a significant portion of the mundane, often frustrating, parts of their job, allowing them to engage with the business and be proactive. In other words it invokes behavioural change.

If you take a look at the Change Drivers' website you will see an entire section devoted to Driving Change. Whilst Intilecta addresses this challenge in a different way, the site makes a number of interesting points about staff behaviour and driving change within an organisation.

Visual Studio 2008 - Are 3 Pillars Enough?

As some of you will be aware, Dave and myself have embarked on writing the sequel to [VS2005], aptly name Professional Visual Studio 2008, which should be completed early next year.  For the last month or so, while we were waiting for the contracts to be finalised, I have been going through a reviewing process of the chapters from the first edition.  With this now mostly complete it is time to turn our attention to actually writing.  Over the coming months you will see a number of posts relating to Visual Studio across on the Professional Visual Studio website.  This will include things like the table of contents, discussion points that we think the community might be interested in and even some code samples/snippets for you to download.

We have also established a Facebook group through which we are encouraging as much community feedback as possible.  As chapters are completed there will be an opportunity for anyone in this group to access the draft and submit comments/feedback.  There is also rumored to be a prize for most active reviewer! The group is currently hidden so if you want to be involved you will have to "be-friend" me and let me know you are interested in providing feedback.

The rest of this post will appear in due course across at

In preparation for the release of Visual Studio 2008 Microsoft have been doing a considerable amount of work to make sure their documentation stays in sync with the product.  From past experience the feedback has been that documentation, particularly around new features is essential if Microsoft wants to get good user adoption both prior to and following product release.  To this end there will be updated language specifications for C# and VB.NET, MSDN will be updated to include the new features and there are some additional whitepapers floating around that further discuss some of the features we can expect in Visual Studio 2008.

One such whitepaper is the "An Overview of Microsoft Visual Studio 2008" put together by Tony Goodhew.  In this document it is stated that VS2008 delivers across three primary pillars:

  • Developer Productivity
  • Application Life Cycle
  • Latest Technologies

Reading this I have to pose the question - is this enough to give Microsoft the leading edge when it comes to developer technologies and/or IDEs?  The latter part of this question is easier to answer if you contain yourself to the .NET/Microsoft world.  In this space there is almost no question that Visual Studio is definitely the best option as it closely aligned with where Microsoft sees the future developer trends going. 

Interestingly enough this seems to occasionally backfire, leaving Microsoft on the back foot playing catch up.  For example if you expand the field of vision to the web in general and look at Visual Studio in contrast to other web developer tools there are some significantly limitations.  In VS2005 there was little support for Javascript development, debugging was still a painful process and when compared to Firebug there was clearly no way Visual Studio was playing in the same space.  Back when VS2005 was released this wasn't a significant issue but with the ever growing and dynamic nature of the web, VS2005 is an overweight dinky toy playing in the world's largest super-pit.

When it comes to Application Life Cycle I can see that Microsoft has done considerable work to fix a major shortcoming of Visual Studio.  Now with Visual Studio Team System the ability to collaborate as a team and build a product from design through to deployment is a significant step forward.  Personally I think that the marketing department Microsoft has frustrated companies by breaking VSTS into numerous skus trying to "accommodate" to different types of developers (although the names end up being different, when it comes down to it all the skus are used by developer focused users). imho they should do away with the different role based skus and have standard, professional and universal editions. 

One of the biggest areas that I think isn't highlighted enough is that Visual Studio is more than just a developer IDE.  It is actually a reusable shell that has been refined and is not available to VSIP companies.  Such companies have the option to either integrate their product as an addin or actually reuse the entire shell depending on their requirements.  Of course it's a pity that Microsoft didn't think to reuse this shell for the Expression suite!

Open question: If you were defining the Primary Pillars for Visual Studio 2008, what would they be?

Windows Mobile v's iPhone

A recently conducted survey by Markitecture discussed here at Mobility Today provided some interesting insight into the smartphone wars that are about to begin (or in some cases are already at large). In actual fact the results that 6% of those surveyed would buy an iPhone was imho not a surprise and I'm not sure that this necessarily directly correlates to market share. If you follow the link through to the source at MacWorld there is an arrogant quote by Steve Ballmer about iPhone not getting market share - given how widely Microsoft missed the web boat, can they really afford to be this arrogant in another emerging market.

What I find interesting is that there is an assumption that these phones all play in the same market. There has never been any secret that Windows Mobile devices are focused on the enterprise market where synchronisation of email, calendar and contacts are essential.  Further they have a well established set of developer tools and apis that can be used to build rich applications, that can be deployed within an organisation to better equip their mobile staff.

The question remains as to where the other players fit.  In the case of Blackberry it is again easy as it is almost entirely enterprise customers.  Nokia and Motorola have for the most part been focused on the consumer space but increasingly we are seeing devices, such as those running Symbian S60 or Windows Mobile, that are capable of being used in the enterprise. Lastly the iPhone - well given the distinct lack of developer apis or programming model it can hardly be considered a true smartphone but it does have the standard POOM feature set for managing contacts, calendar and email so it could be used within the enterprise.  It appears from the marketing campaigns by Apple that they are going for consumer buy-in which they are hoping will put pressure on the enterprise market for adoption.

Going back to the post at Mobility Today the first comment struck me as it is basically flaming Microsoft for poor product quality.  Windows Mobile is similar in a number of ways to any other version of Windows - Microsoft creates the operating system, then hardware manufacturers have to build appropriate drivers/customisations to suit their hardware.  In the case of Windows Mobile this often leads to the introduction of bugs (such as this issue with the notification broker on the JasJar) which unfortunately reflects poorly on the entire platform.

Further Microsoft have had their own set of ongoing issues relating to synchronisation with/through the desktop - you would have though after years of negative feedback on ActiveSync they would think to invest the time/resources to getting it right. Unfortunately they don't seem to have acknowledged that there is still an issue, and to make matters worse they keep removing features! First they removed synchronisation via ethernet as it was a security risk (why not just fix the issue!) and now with the Windows Mobile Device Center they seem to have removed even more features. Being a developer using Vista I am yet to be able to get the emulator to consistently connect via WMDC so that I can debug my application without using a real device.

Having said all this, the Windows Mobile platform rocks in terms of being a developer platform.  The extent of the managed apis, the .NET Compact Framework, Sql Server Compact Edition (and synchronisation via RDA or Merge Replication) and other developer frameworks (the Mobile Client Software Factory and the Smart Device Framework) make it an awesome platform for building occasionally connected rich applications!

New Technologies != Better Architecture

Continuing my reading of The Architecture Journal (following yesterday's post) I was a bit taken aback when I read this in the interview with Microsoft's chief software architect, Ray Ozzie:

AJ: As readers think more about embracing a Software + Services model, where should they start today? And how do they know when they are successful?

RO: I’ll start with the last one. If they are achieving business goals and objectives, then they are successful. As for where they should start, from my vantage point, I would recommend becoming extremely fluent in the technologies, both from a developer and a designer perspective. For the Microsoft platform, this means understanding Expression Studio and Visual Studio. Then continue, explore, and prototype things in WPF (Windows Presentation Foundation) on Vista; it’s an amazingly powerful tool.

There are two points I would like to highlight here - I 100% agree with Ray's initial comment about "achieving business goals and objectives".  IT is never self fulfilling as we are a negative cost centre - Any team that isn't driven by business needs, whether they be internal needs or customer request, should be replaced, restructure or removed.

Unfortunately Ray then follows this up with one of the most far fetched comments I've heard in a long time.  Don't get me wrong I have a lot of respect for Ray and he's been in the industry long enough to know what he's doing but I seriously think the second half of his response leaves a lot to be desired.  Remembering that the target audience here is enterprise architects - do they really need to understand the inner workings of Expression Studio and Visual Studio? How relevant is the choice of WPF over WinForms in building a Software + Services system?  Surely this is an implementation decision rather than an architecture decision. 

Just because WPF is new (albeit slow) and Vista is shiny (albeit slow, broken and generally frustrating) doesn't make them the right choice for an enterprise.  Further I would argue that WinForms, which is tried and tested is adequate for building Software + Services.  If you look at deployment with WinForms you don't need to worry as much about hardware requirements or minimum operating system requirements and it's a technology that your development team already probably understands.  Companies should stop riding on the bleeding edge and focus on building (or deploying) systems that are going to instigate behavioural change within an organisation.

Occasionally Connected RAD Framework

This morning I was reading the latest edition of The Architecture Journal and was intrigued by the opening article "The Internet Service Bus".  In this article Don Ferguson, Dennis Pilarinos and John Shewchuk discuss different development processes, namely opportunistic  and systematic development.  The former represents applications that are organically grown within an organisation typically around line of business applications, for example a spreadsheet application to calculate end of month figures or a simple sharepoint site to facilitate document collaboration.  Systematic development on the other hand is representative of applications/products that are designed, modelled, coded, tested - ie there is a life cycle approach to their development, hence being referred to a systematic.

If you look at the trend around web 2.0 versus more traditional application development there is a clear tend towards opportunistic development.  As can be seen with large websites such as Facebook where applications and/or features are frequently unavailable, presumably due to an issue introduced through adhoc style development.  If developments were thoroughly tested and a proper deployment plan followed their should be close to zero downtime for these services.

On the flip side of the coin the issue with systematic development is that it typically takes way too long to get from user requirements through the design and development process, to the point where the user gets to use the end product.  The end product usually misses the mark, the end user gets frustrated and goes back to their spreadsheet and does a bit of opportunistic development to get the results they want.  Eventually their input gets fed back to the development team and in a few lucky cases affects future releases.

Interestingly this is where the application model that [Intilecta] have built over the last year comes in.  Unlike normal rich client applications that have an updater model that updates the entire application, the Intilecta product supports an synchronisation model that allows parts of the application to be dynamically added, removed and even updated while the application is running. How does this help the end user?  Well it means that their requirements can be fed into a much simpler development process.  Their requirements can be designed, built and implemented with almost zero impact on the rest of the application.  This significantly reduces the time required to test the new functionality and it can be immediately rolled out to either individual users, groups of users or the entire organisation, all controlled from an administrative console.

In the title of this post I mention "Occasionally Connected" which, if you regularly read my blog, you will appreciate is one of my areas of interest.  Web applications (or applications that require an always-on connection) are BAD.  I'll repeat that, they are BAD and you should NOT invest in these applications just because they claim to be Web 2.0, SaaS or some other new acronym.  This is not to say that we should stop building web applications - they definitely have their place.  Further we should definitely build as much of our application as services as possible.  But the reality of a lot of people is that they don't always have a connection available - they might be in a plane, in a network black spot, an office without a connection, or worse just in a location where there is no free wireless (like where I'm sitting at the moment in North Sydney).  This means that we should be building rich applications that are capable of working when we are offline or occasionally connected. 

With this thought in mind, the Intilecta product is built around the concept of synchronising not only functionality but also data to support that functionality.  When functionality is added it is typically done by specifying the data and the visualisation of that data (and in the case of data entry the layout of the data capture screen).  With appropriate data integration this functionality can then tap into any existing data within the organisation whether they be represented as a service, and enterprise data store or even unstructured data.

In summary the technology behind the Intilecta product suite is an Occasionally Connected Rapid Application Development Framework.

Why Google should stick to building websites!

Over the weekend I have been navigating around Sydney catching up with friends.  Although I've been to Sydney quite a few times I still have to look up street addresses.  So rather than purchasing a street directory I figured I would use some technology and try out Google maps.  Now navigating any website whilst on the road is both painful and expensive (see my previous post regarding Australian data costs) but luckily Google have a Windows Mobile client application.  Being one of the first client applications that I've ever used from the search engine giant I was pleasantly surprised that it installs easily, appears in the programs, loads quickly and is both easy to operate and quick to download maps.

image image

As you can see from the image there are virtual buttons for zooming in and out.  Navigation is simply a matter of dragging the screen around with a stylus or your finger.  To improve operation the maps are progressively downloaded and cached as you move drag the map.

So why should Google not build client applications? Well, for a long time there has been a clear divide between the Microsofts of the world, who understand that there may not always been a network available, and the Googles of the world, who believe that the whole world is always connected.  This is evidenced by what happens when you try to navigate outside the cached maps while not connected:


Not only does the Google maps application crash, if you attempt to restart it, the map will appear for a split second before the application crashes again.  Luckily there is enough time to reposition the map so it uses only cached maps which means you can continue to use the application - while you remain on the cached maps.

Another annoying "feature" (actually I call it a bug but hey who's counting) is that while the application is visible the power button is effectively disabled.  I typically press the power button to place the device into standby to conserve power but the Google maps not only prevents the device going into standby, it also prevents the auto-dim of the background light - ensuring maximum power usage - what were they thinking!

I suspect that despite these issues the Google maps application still makes getting from A to B a painless process. Definitely recommend getting it for your Windows Mobile device - If anyone comes across a version compatible with Live Local let me know (I haven't really taken a look to be honest).

Australian Microsoft Developer User Groups

Back in 2002 when I, with the help of Power Business Systems, started the Perth .NET Community of Practice there was a lot of emphasis being placed on building the community by Microsoft.  All around the country the DPE team worked with user group leaders to help support the groups wherever possible.  This included flying speakers around each month, providing content if required and helping to co-ordinate venue and catering.  With a succession of failed activities, such as the MSDN Connection Program (great idea, weak implementation) and the Visual Studio 2005 launch event, to name two that come to mind, we now don't see anywhere near the support that we used to.  A lot of this comes down to budget, and the ever increasing range of developer orientated products that the DPE team have to know, promote and support. 

If you check out the MSDN Australia map of the user groups, located here, you can see that there are approximately 40 user groups around Australia.  You can begin to understand why the DPE budget doesn't go very far these days - back in "the good old days" there was only really a single developer user group in each of the major cities (with perhaps the exception of Sydney and Melbourne). Having said that, someone at Microsoft should really look at this list and remove those that don't appear to exist any more (such as Hobart) and those that don't appear to meet any more (such as Geelong). 

What I wanted to do in this post was highlight the developer user groups - the ones that are essentially the .NET user groups based in the major cities (my apologies if I don't include your user group in this list - feel free to contact me if you want me to expand the list). Hopefully this information is correct and please contact me if you think anything isn't accurate.


Canberra .NET User Group

3rd Thursday of the month, lunchtime (12:30 @ King O'Malley's Irish Pub) and evening (4:30 @ MS Offices). 
Co-ordinator: Athena


Sydney Deep .NET User Group

1st Thursday of the month, 6pm @ AMP building.
Co-ordinators: Nick Wienholt & Dan Green

Sydney .NET User Group

3rd Wednesday of the month, 5:30 @ MS Offices.
Co-ordinator: Adam Cogan


Queensland MSDN User Group

3rd Tuesday of the month, 5:30 @ MS Offices.
Co-ordinator: Mike Fitzsimon

Gold Coast .NET SIG

Adhoc, 6pm Griffith University.
Co-ordinator: Shea Strickland


Adelaide Dot Net Users Group

2nd Wednesday of the month, 5:45 @ Innovation Centre.
Co-ordinator: Peter Griffith


Victoria.NET Dev SIG

2nd Tuesday of the month, 5:30 @ MS Office.
Co-ordinator: Mahesh S. Krishnan


Perth .NET Community of Practice

1st Thursday of the month, 5:30 @ Excom Training Centre.
Co-ordinators: Mitch Wheat & Alastair Waddell

Sydney - One Week On

On my wanderings around North Sydney in search of a place to live I came across this car and couldn't resist a walk-by photo - Nerd on Call, what a brilliant concept!


A couple of people from Perth asked for a photo of me by the Opera house.  These photos aren't great (the HTC Touch only has a 2 Mega pixel camera) but they show how beautiful Sydney is under the night lights.


The Sydney Harbour Bridge 


The Opera House and Sydney by lights

More Update Issues

Two days ago a security update was released by Microsoft for Visual Studio SP1.  Full information is available here but it essentially states it is an issue with Crystal Reports for VS. 


Since I don't generally install that bloatware it would seem reasonable that I shouldn't have to download and install the update. Well not only does it come down as an Important update, it also won't install properly.  Actually that is slightly incorrect, it installs fine but then appears a few minutes later as a required update.  This has been documented by Jason Nadrowski and I suspect that Jamshed from Microsoft was going to contribute but his post has mysteriously disappeared (original link was - sounds like sensorship to me!)

Update: There is a newsgroup thread ( that talks about this where a Microsoft representative acknowledges this as a known issue that they are working on.  Me thinks some better testing is in order as this update issues seems to be affecting almost all users that don't have Crystal Reports installed (including a University where they have rolled out VS2005 to 90 machines, which all now claim there is a missing update!).

The Symbian Conversion

I've been a fan of Windows Mobile devices for the last couple of years for the sole reason that the development model is imho far superior that what's been available for Blackberry, Symbian etc.  However this is all changing as the mobile phone wars intensify.  With the introduction of the iPhone we are seeing a plethora of mobile web applications being built but of course this brings with it the pain found on the desktop of having to support multiple browsers on multiple platforms.

On the other hand we are starting to see Microsoft's position with regards to the .NET Framework loosen so that in the coming months/years we are likely to see a cut down version of the .NET Framework working across browsers/platforms.  And this move will hopefully mean that we can build rich media applications for mobile devices in a similar way as we can now build Silverlight applications for the desktop.

Of course this is all looking way to far into the future for most developers but something that is of interest right here, right now is the expansion into rich applications for mobile devices.  Today I was reminded to go across to the Blackberry developer site where they have a Visual Studio 2005 addin that gives you designer support for building Blackberry MDS applications that consume .NET webservices.  Unfortunately the MDS application itself still can't be written in .NET being the limiting factor when it comes to building cross platform applications.  Of course you can still build mobile browser applications for the Blackberry but then you loose the ability to sync data and work offline.

Earlier this month one of the team across at Red Five Labs reminded me that they were close to release.  I posted a while ago about their intitative to create a runtime for the Symbian S60 platform to run .NET Compact Framework applications.  As they approach a commercial release I am almost convinced to go and get an S60 device (the Nokia N95 or E65 look like nice phones). Unfortunately there are two limitations of this runtime that will prevent me looking at it in any seriousness:

  1. It's .NET CF v1 - This would require me to do a lot of rework to port v2 applications back to v1.
  2. Lack of a data platform - There is no local database supported.  On the Windows Mobile platform we have SQL Server CE(SSCE) or VistaDB.  Of these SSCE supports Merge Replication (and potentially Sync Services in the future).  This is a significant consideration when building applications that are designed to work offline.  Whilst investigating a few alternatives I did come across an MSDN article (whilst old, it might be of some value) that talks about a DataSet approach to syncing and persisting data - see the DataSet Server CE

Power Tools for .NET Compact Framework v3.5

Microsoft have just released the Power Tools for the .NET CF v3.5 B2 that can be download here, which includes:

  • Remote Performance Monitor and GC Heap Viewer
  • NETCF CLR Profiler
  • App Configuration Tool
  • NETCF ServiceModel Metadata Tool
  • Remote Logging Configuration Tool
  • NETCF Network Log Viewer

There are a few known issues (like 25+) but most of them are with the CLR Profiler.

Why do Australian Telcos make life so hard!

For a while now (in fact as long as I can remember) people have been complaining about Australian telecommunication companies, in particular Telstra.  Well today I decided to do the rounds of Optus and Telstra to see just how bad they really are.  A couple of weeks ago I got a 3 mobile broadband data card for my laptop so I got to experience that process too.  Here's a bit of a wrap up about my experience in each case:

The 3 Network

Out of the three networks I sampled 3 was by far the cheapest in terms of mobile data packages - $29 for 1Gb and combined with their capped plans is probably the best for the average business user.  Unfortunately they don't support devices that aren't HSDPA compatible, so my HTC Touch won't even connect to the phone part of the network.  Their plans are also excessively long, requiring you to commit to 24 months (this might be true of the other networks but I didn't get to the point of asking!).

In terms of customer services, once someone realized that you were waiting, and not just specing out phones, they were quite attentive.  That is until you agree to purchase something at which time their brains seem to drift off and the process which should have taken 5 minutes took almost 20 minutes.  Most of the staff, while friendly, are completely useless as they have shallow, if any, knowledge of either the phones or the network itself.


This network was by far the worst for customer service.  I guess it didn't help that I went in at lunchtime and there were a number of people waiting to be served.  Being slightly impatient I decided to grab one of their information brochures and flip through it.  Coming across their data plans I noted that at $29 for something minimal like 100Mb they were almost 10 x more expensive than 3. 

When I finally did get served, by a staff member who was hiding in the back room despite numerous people waiting, I asked why this might be they said "because that's the price it is...." - not very helpful.  I asked whether that was it, or whether he was able to provide any further assistance before turning on my heels and leaving.


As I walked into the Telstra shop I was immediately greeted by on of the sales assistance who wasn't at all pushy but was able to provide useful/knowledgeable information on their network and their pricing.  Whilst Telstra also charge an arm and a leg ($29 for 70Mb) they were at least able to give a reason - This price applies to both their HSDPA service (NextG) but also their GPRS data (3 charge like a wounded bull when you drop back to GPRS mainly because it isn't their network).  Telstra also has much better coverage than any of the other carriers which helps to justify the high price.

The big word of caution about the Telstra network is that you have to use a Telstra approved device.  Even if the device is marked as supporting HSDPA it might not work on the Telstra network - big gotcha for rookie players.  They also don't support people with 2G only phones that want to move across without going up to NextG plans.


In summary, Australia is in a sorry state of affairs - how can data be so expensive for mobile users and the carriers be so incompetent?

Device How To Videos

A while ago I mentioned that MSDN has a series of "How Do I?" videos on a range of topics and that they have some relating to device application development.  Last night someone reminded me about these and I went back to the site to discover a number of videos on some quite interesting, and relevant, topics:

Everything is Go this Weekend

Things are looking up for a monster weekend of activity:

  • For those who don't already know I'm making the move to Sydney on Sunday evening, so there is a fair bit still to be done.  I've just got back from lunch with the residents from the Silicon Beach House and then later we're off to the pub for some farewell drinks.
  • Tomorrow is the day of the move - everything I own has to either be moved into storage or packed to come with me to Sydney - YAY!
  • The Hockey club has their wind-up event tomorrow evening
  • Today Dave and I signed the contracts for the next edition of [VS2005] and the website went live earlier this week - Any spare time I have over the next 6 months will be consumed with getting the best possible book out.  If you want to add comments or suggestions either drop past the website or find me on Facebook and ask for an invite to the reviewers group.

Another Day, Another Attribute

Today Hadley pointed out some non-intuitive behaviour of the DefaultValueAttribute.  Actually after you work out how Visual Studio interprets this attribute it does make sense but initially the logic appears to be flawed.  Ok, so what am I talking about? Well say you have a custom control and you have a property defined as the following:

private mTitle as String
<System.ComponentModel.DefaultValue("Hello World")> _
Public Property Title as String
    Return mTitle
  End Get
  Set (ByVal value as String)
  End Set
End Property

When you drop this control onto a form the Title property will appear in the property grid and you can specify the value that will be assigned to the property in the designer file, eg:


Now the weird thing is that when you look at the property grid the value appears to be set to nothing or an empty string, but surely we set the default value in the attribute?  wrong, what we set in the attribute is what the designer uses to check whether what you have typed is equal to the default value.  For example if I typed "Hello World" into the property grid it would remove the UserControl1.Title=xxxxx line from the designer file.  This attribute assumes that somewhere along the line you, as the developer, will have set the default value, eg:

private mTitle as String = "Hello World"
<System.ComponentModel.DefaultValue("Hello World")> _
Public Property Title as String
    Return mTitle
  End Get
  Set (ByVal value as String)
  End Set
End Property

VB 9.0 Feature Focus

In my previous post I commented that VB is coming of age in Visual Studio 2008 with better support for some of the debugging attributes.  One of the blogs that I regularly read is the B#.NET blog and recently Bart has been doing a VB 9.0 Feature Focus where he goes into a bit of detail about some of the cool new functionality that VB 9.0 has (most features are also supported by C#, but there are a few like the XML integration that makes VB a truely awesome language to code in).  Anyhow some of the posts to date are:

VB.NET Meets the DebuggerDisplay Attribute in VS2008

One of the most annoying things I find about working with the Guid class is that in order to see what the value is you have to go into a watch window and query myguid.tostring(), this doesn't sound like too much work but if you are used to relying on datatips it can quickly be quite annoying.  For a while I've thought about writing a debugger visualiser or type proxy to add my own datatip for the Guid class and today I got off my backside and did it.....

The steps for doing this are relatively simple:

  • New Project (VB.NET or C#, doesn't really matter - at this stage anyhow)
  • Add Reference: C:\Program Files\Microsoft Visual Studio 8.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.DebuggerVisualizers.dll
  • Add the following attribute to any code file (most likely assemblyinfo.vb)
  • Imports Microsoft.VisualStudio.DebuggerVisualizers
    <Assembly: DebuggerDisplay("Guid {ToString()}", Target:=GetType(Guid))>

Now build this assembly and drop it into Documents\Visual Studio 2005\Visualizers.  Open up a new instance of Visual Studio, open an existing or new project that uses the Guid class.  Run the project with a breakpoint set so you have an instance of a Guid that you can mouse over:


And hey presto you have a useful datatip for the Guid class...... WRONG.  What you see here is the datatip in Visual Studio 2008 for VB.NET.  In Visual Studio 2005 this only seems to work properly for C#, VB.NET doesn't seem to properly support the DebuggerDisplay attribute (Note you can still follow the above steps in either VB.NET or C# to create the implementing assembly, it's just the executing code that needs to be in C# in VS2005).