Automating the Righthand Dataset Visualizer build process and a refresh build

Since the last version released I become aware of an issue in the visualizer. If you were working on a project that referenced newer DevExpress assemblies the visualizer might have reported an exception due to the binary incompatibility with its references to the DevExpress assemblies - a assembly binding issue.

(If you want just the binaries you can skip to the end of the article and download them.)

The solution is to use a custom build of DevExpress assemblies. If you have their sources you can build your custom DevExpress assemblies using these useful scripts.

Then I have to use those custom built assemblies with my visualizer but I want to use them only for release build, not for debug. So I created a folder named CustomAssemblies under visualizer solution. I added a reference path to this folder to all of the visualizer projects. Which means that the MSBuild will use assemblies in this folder if they are present or ones from GAC (the original ones) if the folder is empty. Unfortunatelly the reference paths are global to the project and you can't have two different sets for two different configurations.

So the building of the release version looks like: populate CustomAssemblies folder with custom DevExpress assemblies, run MSBuild on Release configuration and at the end clear the CustomAssemblies folder so the debug version works with the original DevExpress assemblies. But there is one more obstacle. The license.licx file lists public key of the DevExpress assemblies and it doesn't match the one found in custom version. So I have to replace all occurences of the original public key with my custom version public key before the build and restore the originals after the build. Problems solved.

The actual release process involves also {SmartAssembly} which merges all assemblies into a single file and signing it with a certificate+timestamping and finally zipping the rather large result. Because I am not a masochist I decided to create a FinalBuilder project that does all of this automatically for me (except for building custom DevExpress assemblies).

Let me know if there are still problems!

Righthand.DebuggerVisualizer.Dataset.2008_v1.0.1.zip (12.67 mb)

Righthand.DebuggerVisualizer.Dataset.2010_v1.0.1.zip (12.67 mb)

Read more about Righthand DataSet Visualizer here.

What’s new in C# 4.0 presentation at NTK 2010 in Portorož

Tomorrow I am talking about new features in C# 4.0 at NT Konferenca in Portorož, Slovenia and I’ll be there through all day. So if you want to hear what features were added to C# in its latest incarnation you are welcome to attend the presentation taking place in Emerald 1, 14:45 - 16:00.

Later I’ll participate in MVP Panel in MSTech (Pečina), 16:30 - 17:30 and as a SLODUG lead I’ll be present at SloUG meeting in Sunset, 17:30 as well.

If you just want to talk about something .net-ish or just want to say hi, feel free to find me as I’ll be lurking around during my free time.

BTW, the official NT Konferenca twitter tag is #ntk10.

Righthand DataSet Visualizer now supports Visual Studio 2010

New in 0.9.16: added support for Visual Studio 2010 and updated user interface a bit. As before, everything is merged into a single dll file which is also digitally signed now.

Thanks RedGate {smartassembly} obfuscator tool for merging everything into a single DLL (ILMerge and another 3rd tool failed in this task). So far, I can only praise {smartassembly}.

Read more about Righthand DataSet Visualizer here.

Download the newest and older versions from download section.

Enjoy, and let me know whether you miss features or if you have any other feedback, good or bad.

Visual Studio 2010 and .net 4.0 are being released today

Today is the day. See Soma’s announcement and prepare your browsers pointed to MSDN Subscriber Downloads. The goods should be available for download starting at 10AM PST which translates to 19:00 for Slovenia (you might check out other local times).

Also watch the Visual Studio 2010 launch event live here.

Some useful links:

Enabling and understanding code contracts in Visual Studio 2010 beta 2

Code Contracts are a new way to do both runtime and static checking of your code coming with .net 4.0/Visual Studio 2010.

Prerequisites

Visual Studio 2010 beta 2. To enable Code Contract project tab you need to update code contracts by downloading the latest version from Code Contracts web page. You’ll find very good introduction documentations on the same side from Documentation link (PDF).

Here is a really simple example of a code that uses Code Contracts

static void Main(string[] args)
{
    decimal c = Divide(4, 0); // fails validation because b == 0
    List<int> list = null;
    Add(list, 5); // fails validation list == 0
}

static decimal Divide(decimal a, decimal b)
{
    Contract.Requires(b != 0);
    return a / b;
}

static void Add(IList<int> list, int element)
{
    Contract.Requires(list != null);
    Contract.Ensures(list.Count == Contract.OldValue(list.Count) + 1);
    list.Add(element);
}

Pay attention to Contract static class and its Requires (pre-condition) and Ensures (post-condition) methods. There is lot more to these two methods i.e. you can even access original argument values through OldValue method – make sure you read the documentation.

Just the code by itself won’t do much. To enable both runtime and static checking you have to open project properties and check Perform Runtime Contract Checking and Perform Static Contract Checking checkboxes. If the static analysis has been checked then you’ll see warnings in the Error List (and Output) window regarding contracts failures. If you enable runtime checking you’ll get assertions (by default, but you can easily switch to exceptions) when the program execution hits contract checking failure.

The interesting aspect of Code Contracts is how it implements post conditions – it injects the proper code at the place of the post condition methods. Something like Post Sharp has been doing for years. Looks like AOP is slowly getting into the .net after all.

Try it for yourself.

Easy way to edit Visual Studio’s project file using XML editor

There are times one needs to edit a project file (csproj, vbproj or others) in XML editor or just text editor because all settings are not available through UI or perhaps it is easier. I usually right clicked on project node in solution explorer to open the folder (in explorer) where project file resides  and then edited the file using Notepad2.

Watching Hanselman’s podcast on MVC 2 I found that there is an easier way to do it. Right click on the project, do the unload project, re-click on, now unloaded, project node and pick edit yourproject.XXproj context item. There you go. After you’ve done editing, save it and pick reload project to continue working.

Visual Studio 2010 beta 2 and .net 4.0 beta 2 available on MSDN

Both Visual Studio 2010 beta 2 and .net 4.0 beta 2 are available for MSDN subscribers and on Wednesday for everybody. Perhaps an important feature is that a “go live” license is available.

Release has been announced for March 22th next year. I guess RTM will be available before the year’s end for MSDN subscribers – judging from the Visual Studio 2008 timeline.

Here is a bounch of useful beta 2 launch blog posts:

About TFS 2010

Hanselman’s post

Jason Zander’s post

What’s new for the Task Parallel Libary

ScottGu’s post

and of course Somma’s post

Just don’t forget that this is beta 2 release and you should be cautious – installing it in a virtual machine rather then production one is always a good practice when dealing with early builds.

My favorite features in upcomming Visual Studio 2010/.net 4.0

The following two are my favorite features comming with .net 4.0 and Visual Studio 2010:

  • parallel extensions - a great and easy way to utilize those idle cores in your multi core machines. It might be as easy as adding an AsParallel() extension method to a LINQ query. I even did a bunch of presentations on the topic, the last one at NT Konferenca 2009.
  • code contracts - improving the code in both design time (static analysis!) and runtime (note: albeit this feature is a part of .net 4.0 beta you have to download the package to install design time support for Visual Studio 2010 beta. This step is supposed to be redundant for RTM or sooner).
Perhaps there are other better features however these two are the ones I am most interested *currently*. So, what are yours?

Running Visual Studio 2010 beta under VMWare Workstation 6.x

There are some graphical problems, probably due to new Visual Studio’s WPF UI, when running shinny new Visual Studio 2010 beta under VMWare Workstation: things like menus disappearing, strange artifacts appearing, etc.

Luckily the solution to this is very simple:

  1. make sure the virtual machine is turned off
  2. open virtual machine settings, go to Hardware tab and select Display
  3. Turn off Accelerate 3D graphics (DirectX 9.0c) option and that’s it.

disable

Picture quality might be a bit lower but at least everything will work. Btw I’ve installed Visual Studio 2010 in both Windows XP x86 and Windows 7 x64 virtual machines and it works just fine when graphics acceleration is turned off.

Update 9.12.2009: Workstation 7 supports WPF/Aero with hardware acceleration.