Woo hoo!

Mon, August 27, 2007, 05:26 AM under Personal
Since last Friday I have been out of office, specifically back home in Greece, and the week culminated in our wedding yesterday (Greek Orthodox version of the civil one from exactly a year ago). In a few hours the real holiday starts with our honeymoon in the Maldives. Can't wait!

In the mean time, if you are addicted to my content (delusional? Moi??) I invite you to browse some of my older posts that you may not be intimately familiar with:
Start with the best of 2004 and then best of 2005 and finally - you guessed it – best of 2006. Another way to pass your time here is to browse by category e.g. Vista, Mobile & Embedded, Events, Links etc. If you are sick of all my Orcas posts, why not read my older Whidbey or general .NET posts? If you prefer narrower topics, why not learn about SideShow and UAC. If you just stumbled on this blog, why not subscribe and keep up to date? Look at the multiple, rich and flexible "Subscribe" options on the left.

Normal blogging service will resume when I come back with photos posted at the usual place

Video: Build UAC aware apps with VS2008

Thu, August 23, 2007, 04:22 PM under Orcas | VisualStudio | UAC
One of the improvements in Visual Studio 2008 for building Windows Vista applications that work correctly with User Account Control is the ability to embed manifests in Visual Basic and C# projects. Watch my 15' video to see how.

Video: VS2008 Aesthetic and Usability enhancements

Wed, August 22, 2007, 12:54 PM under Orcas | VisualStudio
If you ignore the framework and compilers, then what is new in Visual Studio 2008 purely from an IDE perspective? Find out in my 10' video here.

Office projects require NETFX 3.5

Sun, August 19, 2007, 09:25 PM under Orcas
If you try to use VSTO v3 in Visual Studio 2008, you'll notice that the project templates are only available when you select .NET Framework v3.5 (via the multitrgeting feature). You'll probably ask yourself "why?".

The answer becomes obvious when you realise that the MAF (part of Fx 3.5) is actually an evolution of the add-in infrastructure used by the Visual Studio Tools for Office team. They worked on this initially and in the 3rd iteration handed it to the CLR team so it could be baked for public use, not just private use by the Office add-ins. So, now they still depend on it of course which is why the VSTO redist depends on Fx 3.5. They also took further dependencies on some of the new security bits in System.Core, WindowsBase in Fx 3.0 for the packaging APIs and some other less major things. Now you know ;-)

NETCF Beta 2

Sat, August 18, 2007, 06:49 PM under MobileAndEmbedded | Orcas
I got asked about new things in .NET Compact Framework 3.5 with the VS2008 Beta 2 release. Well, the NETCF team did all their good work very early on so there aren't any new features in this drop. Tons of new stuff compared to v2.0 of course, see my previous posts starting here.

In Beta 2 of NETCF 3.5 compared to Beta 1, I observe a couple of classes gone from the WCF stuff, some refactoring in System.Xml.Linq and some changes to mirror the System.Core changes I mentioned here in the 1st paragraph for the full framework.

The only major change is that the DataSet extensions have been factored into their own assembly: System.DataSet.Extensions.dll. This again mirrors the full framework implementation but internally the classes are not in sync yet. They will be by RTM, so my suggestion is to explore the LINQ to DataSet on the desktop, and use the same skills/code when it finally makes its appearance in the NETCF as well.

VS 2008 Tools menu

Fri, August 17, 2007, 08:16 AM under Orcas | VisualStudio
I opened the Tools menu of VS2008 Beta 2 and observed three changes compared to Beta 1. Can you spot them without reading beyond the screenshot:

(Obviously the "Upgrade Visual Basic 6 Code..." is not available in C# projects but everything else is the same in C#)

That's right:
1. The "Device Emulator Manager" moved up next to the other Device options.
2. There is a new menu item "Partner Product Catalog" which seems to open a web page with VSIP members.
3. The "WCF SvcConfigEditor" is back. For more on this configuration editor tool visit the relevant msdn page.

.NET 3.5 video

Thu, August 16, 2007, 06:09 PM under dotNET | Orcas
Want a lightning quick tour of the complete list of .NET 3.5 assemblies and where to find them? Wanna know how I personally explore new DLLs? Watch my 14' video here.

No More Moth

Thu, August 16, 2007, 11:02 AM under Links
For those of you with blogs out there, how many times do you genuinely search for something on the web only to get your blog as the top result? As pleasing as it is to see your blog in the top search results, sometimes it just gets in the way because you know darn well that you do not have the answer on your blog (or else you'd just search that, rather than the whole wide web, right?).

I somehow ended up having a similar conversation over email with one of our interns, Ian MacGillivray, here at Microsoft UK and he found a solution (showing off LIVE's rich customisation) and it looks like he is phishing for a link to his blog now... So, if you want to see how LIVE is superior to Google or how to create your own customised search engine or how to search the web excluding my blog (not recommended!), read the post from Ian MacGillivray aka Bartholomew ;-)

Watch my video on VS2008 multitargeting

Thu, August 16, 2007, 02:35 AM under Orcas | VisualStudio
Soma writes about one of my favourite features of Visual Studio 2008 (that is actually an msbuild feature). If you want to see it in action, watch the 15' video I recorded last week on channel9.

LINQ to SQL in Beta 2

Wed, August 15, 2007, 10:56 AM under Orcas | LINQ
LINQ to SQL has had some positive changes in VS 2008 Beta 2.

The most significant is that it is now faster (for background to this, see Rico's post) and has numerous bug fixes. Another very visible change is that for customisation, partial methods are utilised everywhere (LINQ to SQL was one of the drivers behind that feature). An aesthetic tool change is that when you map your database to the auto generated classes, you do not add a "LINQ to SQL File" item, instead you add a "LINQ to SQL Classes". It also has a much more professional icon rather than the old one that looked like it was drawn by... me! Here is the new one:

Opening System.Data.Linq.dll in your favourite dissasembler will reveal quite a few refactorings, but instead of looking inside out, I'll hand it over to Dinesh that has a fuller change list.

Visual Basic video

Tue, August 14, 2007, 05:49 PM under Orcas | VisualStudio
I recorded a 13' video on the improvements in VB intellisense (codenamed "intellisense everywhere") with VS2008. For more context and to watch it go here.

NGEN perf boost in red bits

Tue, August 14, 2007, 01:27 PM under dotNET | Orcas
One of the fixes to the updates for CLR v2.0 (that we will receive when Fx 3.5 ships) is ngen performance improvements (inc. for WPF assemblies). Read the full story here.

VS2008 supports Restart Manager

Tue, August 14, 2007, 03:15 AM under Windows | Vista | Orcas | VisualStudio
Two of my favourite new APIs of Windows Vista are: restart/recovery and Restart Manager.

I mentioned in passing that Orcas March CTP supported the restart API. I haven't had a chance to test if that area has been improved because I can't get Visual Studio 2008 Beta 2 to crash! If you have a repro case that crashes Beta 2, please let me know how.

How about Restart Manager support by Visual Studio 2008? I had tested this with Beta 1 and the answer was "no". Tested it with VS2008 Beta 2 and the answer is a resounding "yes". Not only it supports RM for being gently shutdown, but it actually does the right thing when it is restarted which is to auto open the solution you had open even down to the file you were viewing! If you had a file unsaved, it will prompt you on restart if you'd like to recover:

To see the RM functionality with VS2008 in action on your Vista machine running Beta 2, one easy way is to download my Vista demos, locate the project in the folder "RestartManagerSimulator", build it and then execute from the Debug folder the executable: RestartmanagerSimulator.exe. You should see an app that looks like this. In the textbox enter "devenv" (without the quotes) and hit the buttons in order: "Supports Restart?", "Register" and "Shutdown". Wait while that operation completes and Visual Studio exits. Then click on "Restart" and watch the magic happen ;-)

SortOrder in item VS2008 templates dialog

Mon, August 13, 2007, 07:37 AM under Orcas | VisualStudio
One of the annoying things of Visual Studio 2005 is that when you try and add a new item to a project the templates are listed in non-alphabetical order and there is no way to change that from the GUI. There are a couple of workarounds for VS2005 (e.g. see links from here), but they involve more work than to my liking.

Visual Studio 2008 improves the story by (almost always in Beta 2) sorting alphabetically :-)

Nice! The same is partially true for the New Project dialog. Also, as an added bonus, both of these dialogs are now resizable as the screenshots prove ;-)

Relaxed Delegates

Sun, August 12, 2007, 10:53 AM under Orcas | VisualStudio
I knew about covariance and contravariance that we got in the .NET 2.0 timeframe and I also knew that VB 9.0 (shipping with Visual Studio 2008) would fully support the feature and even enhance it. I hadn't appreciated how much it would be enhanced until I accidentally run into it yesterday (while recording a video on VB intellisense improvements).

I created a thread and had the delegate point to a method that I had already written. So I went to change my method to accept the Object as an argument and before having a chance I noticed that VB's background compiler hadn't complained about it!? In case you haven't guessed it by now, in VB9 you can omit the parameter list of a method pointed by a delegate, if you wish ;-)

' No need to type (s As Object, e As EventArgs)
Sub Button1_Click() Handles Button1.Click
Dim t = New Thread(AddressOf MyWorkerMethod)
End Sub

Sub MyWorkerMethod() 'No need to type (o As Object)
'Do sth on worker thread
End Sub

Read more about relaxed delegates on msdn (bottom of the article). Like with all other language features, you can use this one in your .NET 2.0 projects in VS 2008.

prop snippet

Sat, August 11, 2007, 02:24 PM under Orcas | VisualStudio
Hot on the trails of the improvement in the foreach code snippet in VS2008, I found that the prop snippet also changed:

Yup, automatic properties by default ;)

Changes in the red bits

Fri, August 10, 2007, 09:49 AM under dotNET | Orcas
I thought that Scott was trying to steal my thunder with his post about changes from v2.0 to v3.5, but instead he is focusing on the changes in the red bits and not the green bits – thanks! As a reminder the red bits are the same version.

He used libcheck to generate the report. Time for my confession: I have modified libcheck so it works for the .NET Compact Framework and indeed that is what I use to blog here about NETCF changes between v2.0 and v3.5. You can see a very old report of that tool when I was blogging about changes between NETCF v1.0 and NETCF v2.0 RC. I was going to use libcheck for reporting on the red bits, but never found the time to unearth an XP installation with v2.0 RTM on it – shocking I know :-).

I went through the report and other than the obvious additions in the GC the only other change worth talking about is DateTimeOffset which has had a ripple effect to other areas (e.g. XmlConvert.ToDateTimeOffset). Of course, most of the changes to the existing red bits are bug fixes and perf improvements so API differencing will not surface those. An example of an internal change the report will not show is the use of the Vista CommonFileDialog.

Anyway, check out the report on Scott's blog.

VS 2008 SKUs

Fri, August 10, 2007, 04:06 AM under Orcas | VisualStudio
With Visual Studio 2008, like with VS2005, we have the 4 Express Editions (C#, VB, C++, Web) and we also have the Standard and Professional Editions as well. PRO is what I typically use and, with VS2008, PRO now includes support for Unit Testing.

We also have the Team System Editions (Architect, Developer, Test, Database) inc. TFS and Test Load Agent, of course. With VS2008 the names for these have been rationalised and simplified. I may do a post in the future summarising the new stuff in VSTS 2008 (for now, you can view the complete feature list for TFS 2008).

There is also a new kid on the block. I am personally very excited about this and have added to my TODO tome to put aside some time to play with it: Visual Studio 2008 Shell (and its free!).

LINQ samples

Thu, August 9, 2007, 12:57 PM under Orcas | LINQ
I opened the Help menu of Visual Studio 2008 Beta 2 and observed three additions compared to Beta 1. Can you spot them without reading beyond the screenshot:

That's right:
1. MSDN Forums – browses to the MSDN forums.
2. Report a Bug – on my machine takes me here.
3. Samples – opens an htm file from your machine.

That last one is the most interesting to me. It includes hyperlinks to many sample projects on your machine. Clicking on "Visual C# Samples" will open a ZIP file that has two folders in it, one of them called "LinqSamples" that contains the BuildSamples.sln. Open that and you'll have 15 very interesting projects.

Included in that solution (no need to download anything from the web, contrary to following links) is the Paste XML As XElement add in project, the LinqToSqlQueryVisualizer debugger visualizer project and the ExpressionTreeVisualizer debugger visualizer project. Also, worth the admission fee alone is the SampleQueries project with literally hundreds of sample LINQ to everything queries in a format that you can learn from:

Go explore now!


Wed, August 8, 2007, 01:56 PM under dotNET | Orcas
I have updated my Fx 3.5 list of dlls with one more: Microsoft.VisualC.STLCLR.dll.

As its name suggest, this is an assembly for C++ developers. To be clear, it is of no use to C#/VB developers since it is unusable without including the STL/CLR header. The idea is that if you are comfortable with the C++ Standard Template Library (STL) then you can still use the STL from your C++/CLI code. At the same time, it lets you port your existing unmanaged C++ that has investments in STL, to managed C++ without having to re-implement the STL portions – they just work since the STLCLR collections are compatible with the Generic .NET Collections!

For slides, demo and to read more about this assembly, please visit the STLCLR category on Nikola's blog. He has also recorded a video explaining everything about it.

Vista updates

Tue, August 7, 2007, 02:44 PM under Windows | Vista
Both of them installed fine for me (screenshot). If you want performance, compatibility and reliability go get this one and that one.

ASP.NET 3.5 controls

Tue, August 7, 2007, 07:26 AM under dotNET | Orcas
In addition to infrastructure improvements to better support IIS7, and in addition to toolset enhancements, web developers get 3 new controls in ASP.NET 3.5 (specifically in System.Web.Extensions.dll and specifically in the System.Web.UI.WebControls namespace): ListView, DataPager, and now in Beta 2 we see for the first time LinqDataSource.

To read about ListView and DataPager go to Rick's blog and for LinqDatasource see Scott's blog. In addition to those 2 blog posts, Dan has two excellent videos showing off the controls here and here.

LINQ to SQL pipeline

Mon, August 6, 2007, 03:23 PM under Orcas | LINQ
Stumbled upon a great video of Matt Warren (questioned by Luca Bolognese and shot by Charlie Calvert) explaining the pipeline of LINQ to SQL i.e. it assumes you know how to use LINQ to SQL already and builds on that to explain the internals. Watch it here.

foreach uses var

Mon, August 6, 2007, 04:32 AM under Orcas | VisualStudio
Whenever I want to loop through a collection of some sort, in C# I type foreach and hit the TAB key twice (to invoke the code snippet). This gives me the following code template:
    foreach (object var in collection_to_loop)

...where object is highlighted so you can change it to the real type of your collection, var is highlighted so you can change it if you wish to have your own variable name and collection_to_loop is highlighted so you can change it to your actual collection variable name.

This always looked awkward to me when playing with LINQ since I typically use the keyword var to replace the object and then immediately I am confronted with var as the variable name that I change only so the awkwardness can go away.

In Visual Studio 2008 Beta 2 you get the following with the foreach code snippet:

No awkwardness, automatic use of local variable inference and, generally speaking, only one item to replace: collection.

Are you revisiting your own code snippets making them more user friendly?

Extension Members in Object Browser

Sat, August 4, 2007, 05:08 PM under Orcas | VisualStudio
Recall the new C#3 and VB9 language feature extension methods? Well, if you go into the object browser in Visual Studio 2008, there is an option to display extension methods for the chosen class. The following screenshot depicts that for the XElement (from XLinq):

Nice! The 3 extension methods (Validate and GetSchemaInfo) are actually defined in the static System.Xml.Schema.Extensions class, but still show up where we'd expect them to.

The above screenshot is in a VB project and I cannot get this feature to work reliably for me in C# projects yet. The option is there in both projects, but the result isn't. Here is how you enable the feature btw:

Go check it out...

Partial methods

Fri, August 3, 2007, 02:41 AM under Orcas | VisualStudio
With VS2008 Beta 2, we all get a chance to play with a feature that the product teams have been teasing us with by talking about it before it was available in public drops.

[Request to product teams]If your feature is not baked in public bits, please refrain from blogging about it; also please stop posting images of private bits.[end request]

The feature in question is Partial Methods. Wes has an excellent write up here from a C# perspective (that he followed with this) and Scott here from a VB perspective. I suggest you read both since at the conceptual level they are the same. Essentially it is an aid to code generation scenarios in the same way that partial classes are. Think of it as a combination of a more efficient version of private event handlers and the Conditional attribute. Read the previous links for the full story.

My take? I simply thought I'd see the feature in action so without referring to the posts or documentation I fired up Visual Studio to try it out from memory. How mistaken I was. Every time I tried something I was greeted with a compiler error pointing out my ignorance. I was going to post here the series of compiler errors I dealt with one by one until I managed to get the thing to compile, but instead I've tried to summarise a few of them with one line of code:

public partial bool GoGoGo(out int i); //produces the following Error List

What better way to learn than by the compiler teaching you... a bit like how kids learn that fire is hot... by touching it (well, that's the way I learnt anyway). If however you prefer reading a very long thorough post covering a feature (in addition to the 3 posts above by the product teams) and also prefer looking at things through ildasm, then head over to Bart's blog post on the topic.

More VS2008 UAC integration

Thu, August 2, 2007, 04:12 PM under Orcas | VisualStudio | UAC
I've shown before one example of VS2008 integrating nicely with UAC, but today I found another one:

The above dialog appeared after I tried creating a new SharePoint Workflow project. After selecting the "Restart" option, Visual Studio closed, I confirmed the UAC Consent dialog and VS then reopened elevated (with the title bar showing its mode) in the same state it was before.

If you find any other examples of actions that result in an elevation prompt in Visual Studio 2008, please drop me a line (other people collect stamps, I collect UAC screenshots).

UAC Settings in VB

Thu, August 2, 2007, 02:32 AM under Orcas | VisualStudio | UAC
Regular readers of my blog will know that a requirement (and more importantly good common sense) for your applications that will run on Vista is that they have an embedded manifest declaring their requested privilege for working better with UAC. With Beta 1 of VS2008 I showed how this has become a doddle for C# projects. At the time, there was no such easy option for VB projects.

With Beta 2, VB also gets an easy way to do this. If you find the GUI of the C# approach confusing, then you'll be pleased to find that the VB approach is a single button named View UAC Settings, as per the following screenshot:

Clicking on it adds a pre-populated manifest file to your project which you can optionally further tweak to your liking, of course.

Note that in C#, you can manually add Application Manifest Files yourself:

...and switch between them from the IDE. This does not seem possible from the GUI provided by the VB team.

Further note that this feature is obviously applicable for v2.0, v3.0 and v3.5 client project templates in both languages. My advice to you is to open all your client projects in VS2008 and embed the default manifest now with no further thought. Later you can determine if you need to tweak things...

Tool to collect VS2008 and Fx 3.5 setup logs

Wed, August 1, 2007, 10:23 AM under Orcas | VisualStudio
My Beta 2 installation experience was fine and dandy, but yours may not be. If you do face any issues, Aaron shows you how to collect the setup log files for diagnosing.

Unrecognized tag prefix or device filter 'asp'

Wed, August 1, 2007, 03:25 AM under Orcas | VisualStudio
If you are facing the error above with Beta 2, it is due to the changes I blogged about. Doug has a nice step-by-step investigation and the solution.

VSTO for VBA developers

Wed, August 1, 2007, 01:23 AM under Orcas | VisualStudio
A few months ago I posted about Office as a development platform with VS2008. While most of the features are easy for you to explore given the screenshots I posted, on my point 6 I only mentioned VBA<->VSTO interop with no further info. If that feature floats your boat (and it certainly will if you have existing VBA investments and would like to extend them with managed code), then go watch this 8' screencast on channel9 (or this soapbox video here).

There is also a great MSDN mag article on VSTO: Extend Your VBA Code With VSTO. It talks about VSTO and VBA interop in this section, and it also touches on ClickOnce deployment in this section.

Finally, relevant to the above, I thought I'd share a new (to me) acronym that I picked up this month: OBA (Office Business Applications).