.net DevExpress

Creating DevExpress’ XtraForm derived form as partial class

Developer Express offers an XtraForm (a windows form derived from Form class) with Look & Feel default set so you don’t have to use LookAndFeel objects to centralize its appearance. One annoying feature is that when you create an XtraForm derived class using Add/New Item… in VS.NET 2005 beta 2 it will create traditional Form class structure: one file and no partial classes as Form does.

If you want partial class (possible only in Visual Studio.NET 2005) and XtraForm the solution is rather simple: Create a standard windows Form instead, go to its code and change the base class to XtraForm. Voila. The same is true for XtraUserControl.


DirectX wishes for VS.NET 2005

Do you have wishes for managed DirectX for Visual Studio.NET 2005? You are in luck. Tom Miller’s put out a post inviting community to express their wishes for it. And there is no better person than Tom to speak to on managed DirectX topic.


CLR team goes ZBB

It is certainly a good thing that CLR team cleared the bug list for .NET  Framework 2.0. I guess that makes 11/7 even more realistic date.


Is SecureString usable

if you want to keep a secret text in a System.String you’ll have security vulnerabilities. Since it stores the plain text in memory (and you have no control when it will be destroyed as this is controlled by garbage collector) a skillful user could read computer memory somehow and extract the password out of it. So, here steps in (new in 2.0) SecureString class that encrypts the text and stores it encrypted. The downside is that you can’t transform it to managed string since it wouldn’t make sense, as you’ll be back to security vulnerability. That makes, it is useful only for communicating with unmanaged code. What is missing?
For example, it would be useful to have an overloaded constructor for SqlConnection that takes SecureString as an argument (connection string):

public SqlConnection(SecureString connectionString)

However, there is no such constructor. The question is why SecureString isn’t used for stuff like this?

Find more about SecureString in this article.


Visual Studio.NET 2005 sugars

Did you ever find yourself wondering which namespace a class belongs to? One would open the help and use index functionality to find it. Now the process is a lot easier. Just type the class name into the code and, if class is referenced and its namespace isn’t reachable, a little red box will appear at the bottom right side of the class name. This red tiny box is a huge benefit. Hover over it and it will give you two options: either include a proper using statement or prefix the class name with its namespace.

Once you try it you’ll love it.


CodeSmith and Visual Studio.Net 2005 beta 2 story

I already blogged about CodeSmith being a wonderful tool so I won’t repeat my ode again. While CodeSmith is a great tool it doesn’t yet support integration into Visual Studio.Net 2005 beta 2. By integration I mean CodeSmith AddIn window and CodeSmithGenerator. I never find the former particulary useful thus I won’t bother with it. The later it is another story.

Generators are those tools that transform a data file into a source file whenever data file changes or on demand. A typical generator is DataSetGenererator that ships with Visual Studio.Net itself and takes care of transforming dataset schema into strong typed dataset source file. To find which generator is used for transformation you might take a look at data file properties, field Custom Tool. That was a brief description of generators. If you are wondering what does CodeSmithGenerator do it is pretty simple. It takes a properly defined xml file that defines which template to use with which property sets and accordingly produces a source file – basically what CodeSmith does, but this time right within Visual Studio IDE. I won’t elaborate here as it is not in the scope of this post.

So, what’s the problem. As mentioned CodeSmith doesn’t support Visual Studio.Net 2005 and doesn’t install its CodeSmithGenerator to work with it. Fear not, there is a simple solution. Let’s say you are installing CodeSmith on a computer with only Visual Studio.Net 2005 installed.

1. Install .net framework 1.1 which is required by CodeSmith (I am not sure if this step if required).
2. Install CodeSmith 3.0.
3. Add the following data into registry (paste it to a file named something.reg and double click on it).

Windows Registry Editor Version 5.00

@=”CodeSmith C# Code Generator”

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Generators is path to Visual Studio generators registry entries and {FAE04EC1-301F-11D3-BF4B-00C04F79EFBC} stands for C# generators (that work in C# projects). If you want to register generator for VB you should use this guid: instead (you can safely enter both versions) {164B10B9-B200-11D0-8C61-00A0C91E29D5}.

4. You’ll need a CodeSmith installed on a computer with Visual Studio.Net 2003 (if it doesn’t find Visual Studio.Net 2003 it won’t install necessary files). Copy files from C:\Program Files\CodeSmith\v3.0\bin (assuming CodeSmith is installed in C:\Program Files\CodeSmith\v3.0 folder) into target computer.
5. Run Visual Studio .NET 2003 Command Prompt and change directory to C:\Program Files\CodeSmith\v3.0\bin. Run installutil CodeSmith.VisualStudio.CodeGenerators.dll to register the dll as an ActiveX class (that CLSID entry from registry entry in step 3).

That’s it. You are free to run the CodeSmithGenerator now. Ah, yes, there is a minor issue. For some reason you won’t be able to register the CodeSmithGenerator – it will always run in trial mode. That said, I hope Eric will add support for Visual Studio.Net 2005 to avoid these problems in future.


RightHand.DataSet.Visualizer for Visual Studio.NET 2005 is born

Visualizer is a new cool feature of Visual Studio.NET 2005 debugger. It is exactly what I was looking for visualizing ADO.NET’s DataSet data thus I decided to write my own visualizer. And here it is. You are welcome to download, use and discuss it.

RightHand.DataSet.Visualizer is an MDI application that lets you inspect DataSet structure and its data plus tons of other useful operations on DataSet right from within debugger. This version has a time limitation. See File/About box for the expiration date.

Why would I need a DataSet visualizer?

How often does a .net programmer wonder what data a dataset holds? It is certainly not easy to see the data in regular debugger windows. It is even harder to check the structure of DataSet or find which row has an error or which row has been changed. Or even which column of a row has been changed. If you ever worked with either normal or strong typed datasets you should see what I mean.
That’s why the fine folks at Microsoft introduced visualizers – a debugger feature that makes the inspection of complicated data easier. Even Visual Studio 2005 beta 2 already ships a DataSet visualizer (and some others, such as Text, HTML and XML) which is pretty ascetic. Is there a better replacement? Yes, welcome to RightHand.DataSet.Visualizer, a powerful tool that lets you do almost anything on a DataSet including extraordinary UI feedback.


Jump right to the product page.


Visual Studio.NET 200x easily extensible?

Not exactly. Ever tried to write a Visual Studio.NET 200x addin? If yes, then you know that it isn’t exactly easy. Fortunately, there is a cure to this shortcoming and it is a product called DXCore provided by Developer Express. Basically this is an addin that eases writing new (completely managed) addins or better, DXCore plugins. BTW, both CodeRush for Visual Studio.NET and Refactor! (PRO) are based on this core. If you have experience with writing Visual Studio.NET addins or not you will be surprised how easy is to create a custom plugin. Not only that creating plugins is easy, DXCore also provides great deal of functionality that you can use. What’s even better is that DXCore is free! There is also a CodeRush community (community plugins based on DXCore) that offers various useful plugins (mostly for free). Among them are three plugins I wrote:

To tell you the truth I would never write those plugins without DXCore – to much complicated otherwise.

.net DevExpress

Refactoring in VB.NET 2005?

C# 2005 does refactoring and this is a well known (and very welcome) feature by now. A less known fact is that VB.NET 2005 does refactoring, too. Not out of the box. Instead, Developer Express provides a free refactoring plugin based on DXCore (free engine used by CodeRush for Visual Studio.NET). Refactoring is code modification without alterating external program functionality to put is shortly (for more information about refactoring follow the refactoring links). So, if you are “on” VB.NET 2005 beta 2, go check refactoring.
There is also a Refactor! PRO version (not free, works in all Visual Studio.NET 200x versions) that has additional refactorings that are useful in C#, too. Follow the inline links to learn more (so I don’t have to re-write those information :-)). Very interesting feature of Refactor! PRO is that it is extensible – you can add your own refactorings if you wish to. Isn’t that cool?


Visual Studio.NET 200x Debugger Feature

Last week I’ve presented “What’s new in Visual Studio 2005 Debugger”. One of the cool feature is that you can customize the instance value. For example, consider this simple class:

 public class Tubo
   private string Name;
   private string Surname;

In debugger you would see something like:

Variable | Value      | Type
tubo | namespace.Tubo | namespace.Tubo

One way of changing the Value display (the other way is applying DisplayValueAttribute either to class or assembly) is to override ToString() method:

public override string ToString()
   return Name + “, ” + Surname;


This time you’ll see something like this:

Variable | Value      | Type
tubo | “Tom, Arraya” | namespace.Tubo

This way the display is quite a bit more informative than before.

Interesting fact is, that Visual Studio.NET 2003 already has this feature. It wasn’t as easy as overriding ToString() or applying an attribute though. So, how could one customize it in actual Visual Studio.NET?

There are three files located in C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Packages\Debugger folder:

  • mcee_cs.dat
  • mcee_mc.dat
  • vjsee.dat

I am not sure why they are three similar files. Perhaps each of them is linked to certain language (C#, MC++, J#). Anyway, I experimented with mcee_cs.dat since I mainly program with C#. If we go back to Tubo example, I would add this line to mcee_cs.dat file:


and Visual Studio.NET 2003 will display the same value as in our 2005 beta 2 example. I guess the example is simple enough to understand the above line structure. Its get even better. There is a VSTweak PowerToy project going on at GotDotNet web site. I’ve donated an editor for mcee_cs.dat file to the project. It features Intellisense like technology and few automation tricks that helps you create all those nice lines that will help you out inspecting variables.

So, if you want to enhance Visual Studio.NET 2002/2003 debugger display don’t hesitate. The feature is there.