Plunging into .NET Development

Weblog Pieter Gheysens
Microsoft .NET Development - C# - Enterprise Library - Visual Studio 2005 Team System - Compuware DevPartner - ...

Saturday, November 12

Trouble connecting to SSE

After uninstallation of all beta stuff and installation of the final release of Visual Studio 2005, I had trouble adding a new Data Connection (SQL Server Express) to my Server Explorer in Visual Studio. Each time (for a new database and for a database I already created with the SQL Server Management Studio) I got the error : Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.

I did some googling and didn't find a lot of useful information. Only after reading all threads on this forum-post I followed the advice to delete all my user-data of SQL Server Express located at C:\Documents and Settings\*UserName*\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS. Rebooting and reconnecting to SQL Server Express recopied all appropriate files to my local settings and everything worked again. Be sure to try this procedure if you are in a similar situation!

Friday, November 11

The Launch

After the official launch of Visual Studio 2005, SQL Server 2005 and BizTalk Server 2006 (beta ;-)) in San Francisco (November 7, 2005), yesterday it was time for the launch in Belgium.

More than 2000 people were present for this event in Court-St-Etienne. S. Somasegar (Corporate Vice President, Developer Division) did the kick-off and later in the afternoon there were presentations of Visual Studio 2005 (Clemens Vasters) and SQL Server 2005 (Astrid Hackenberg).

For developers with already some hands-on experience with Visual Studio 2005 and SQL Server 2005, there was nothing new to see/hear. It was all about The Launch : a big show with the announcements of the new products. The message was clear : Microsoft is READY (at least for Visual Studio and SQL Server) to roll out the new products in all kinds of high demanding production environments. In a nutshell : with these products, customers will be able to get faster results (productivity boost) and to make better decisions ... all this on a trusted Microsoft Application Platform.

I will also remember the fantastic beatbox-shows between the sessions. These guys were really good! Amazing what they can do with only a mike in their hands.

To top it off, on our way home we all got a Standard Edition of Visual Studio 2005 and SQL Server 2005.

Tuesday, November 8

Free .be domain names

Indeed : free .be domain names!

If you look at the advertising of different hosting providers in Belgium, you will see that they all do similar actions (free or reduced prices for registration of .be domain names). Why? It must have something to do with the arrival of the new .eu domain names. Will .be domain names become less attractive in the future?

The official registration period for .eu-domain names will kick off on the 7th of December 2005. During 4 months, companies and organizations will receive priority in registrating their domain name(s).

After the Sunrise Period [4 months], the registrations will be open for any individual resident in the European Union or any organization or company established in the European Union. But you can now already register for your .eu domain name. First come, first served!

More information at

Enterprise Library 2.0 (CTP November)

Great! Now that Visual Studio 2005 (final version) is a fact, a November CTP of the Enterprise Library is available on the GotDotNet CodeGallery. Still without the Configuration Tool, but already very valuable because the build works on the final version of the .NET Framework 2.0.

Monday, November 7

Track Active Item

The option "Track Active Item in Solution Explorer" is not checked by default in Visual Studio. Check this if you always get lost in all your open files and don't remember in which project you're currently working. It will save you a lot of frustration knowing where you are. This should be checked by default. I cannot imagine why this should be turned off?!

Tuesday, November 1

Role Based Security

When implementing role based security for a project, I've run into a specific problem with a destructor of a class where security was set at the class-level.

My example : a simple class MyServices with a public method Hello and a parameterless constructor and a destructor [normally used to clean up resources of the class]. Above the class, you can see the application of role based security. The PrincipalPermissionAttribute allows security actions to be applied to code using declarative security. Only users belonging to the group Administrators may access the class MyServices.

On the other hand I have a Windows Form with a single button. After the initialization of the form I set the CurrentPrincipal of the running thread to the principal associated with the user currently logged on. When the button is clicked, the Hello method of MyServices is called.

What will happen? Everything runs fine until the destructor of MyServices is called.

At some point (after clicking the button and after the messagebox was displayed) the application throws an unhandled SecurityException : Request for principal permission failed.

The thing is that the destructor of the class is called at an undetermined time by the Garbage Collector (separate thread in the background) and apparently this thread hasn't got the appropriate rights ...

What to do? Well, we've now implemented the IDisposable interface on the class and used an explicit call to the Dispose() method to clean up all resources. Actually this is a better way for controlling the clean up (clean up in a deterministic way), but I'm still wondering how you can fix the problem in the destructor? Is there a way to give the Garbage Collector the appropriate access rights to the class? Or is there a declarative solution for setting less security, only on the destructor of the class? Any ideas on this?