Wednesday, June 25, 2008

I'm sure most of you know about podcasts. Sites like .NET Rocks being one of the most popular for .NET developers. Sooner or later though, you just run out of podcasts. Especially if you, like me, try to waste no time - which includes walking your dog with an MP3 player plugged in :-)

There are also cases when the level of podcasts is way below what you would expect. Once you get a certain level of expertise in any subject, most of the podcasts start to sound lame and that is natural of course - a sign of you progress.

Worst case scenario however is, when there are no audio materials on the subject of interest. Been there, seen that, solved it.

Enter SpeechR.

A small tool that I wrote mostly for myself. SpeechR is a tool that allows me to take any text and convert it into an audio format (wave or mp3) so I can later put it on my MP3 player and listen to while... whatever I do that doesn't require focus.

With all the ebooks out there, with all those lenghty manuals or blog posts and a comming vacation on a beach... What more can a hardcore can you want.

Tool uses System.Speech namespace that was introduced with .NET 3.0 to generate sounds. System.Speech in turn uses Microsoft Speech API found in Windows. With version 5 it got pretty good. Just compare Microsoft Anna in Vista to Microsoft Sam in XP.

Of course, Microsoft's voice isn't perfect - far from it. There are however commercial voices out there that are very good and cost ~30$.

Well. The tool is free, you can install it and enjoy. Please let me know what you think about it and what features you would like to see in v.Next().

Wednesday, June 25, 2008 7:37:27 PM (Central European Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [2]  | 
 Tuesday, June 24, 2008

I'm having some very strange problems lately with my Visual Studio. From time to time, a random feature just stops working. From not being able to pin/unpin windows, through random component not installed/missing, to just not being able to even start the IDE.

Some of the problems go away after restarting Visual Studio. Some of the problems go away after restarting Windows. Some of the problems just STAY!

After asking "Deep Thought" for the ultimate answer to life, I got it, and it was 42...

Naaah. Actually asking google was helpful in a way. It gave me some clues on what can I do to "reset" Visual Studio without reinstalling it or even worse, the whole Windows. The answer was:

devenv /resetskippkgs

Remember this one. You will need it. Sooner or later, but you will. It solves a lot of different issues.

Tuesday, June 24, 2008 9:08:45 PM (Central European Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [2]  | 
 Friday, March 14, 2008

Internet Explorer Enhanced Security Configuration - don't you just love it?

Is there anything worse that Microsoft has given us over last few years? I really doubt it.

Friday, March 14, 2008 5:29:12 PM (Central European Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [1]  | 
 Saturday, September 22, 2007

In my last article on opening a file in Visual Studio, I have described how to write a macro to open a file given it's name. Now we can take it one step further. How about opening a file containing a type name.

Unlike opening a file, where there is a built in function, searching for a type is a complicated task. We need to loop over all projects, all items, and then analyze the code. Other than that, the code is rather simple if you understand recursion:

Sub OpenType()
    Dim typeName As String = InputBox("Type name:").ToLower()
    If String.IsNullOrEmpty(typeName) Then
        Return
    End If
    Dim str As String
    Dim projectItemContainingType As ProjectItem
    For Each project As Project In DTE.Solution.Projects
        projectItemContainingType = FindProjectItemWithType(typeName, project.ProjectItems)
        If projectItemContainingType IsNot Nothing Then
            projectItemContainingType.Open()
            projectItemContainingType.Document.Activate()
            Return
        End If
    Next
    MsgBox("Type not found", MsgBoxStyle.Information)
End Sub
Private Function FindProjectItemWithType(ByVal typeName As String, ByVal projectItems As ProjectItems) As ProjectItem
    Dim projectItemContainingType As ProjectItem
    For Each projectItem As ProjectItem In projectItems
        Dim codeModel As FileCodeModel = projectItem.FileCodeModel
        If codeModel IsNot Nothing Then
            projectItemContainingType = FindProjectItemWithType(typeName, codeModel.CodeElements)
        End If
        If projectItemContainingType Is Nothing AndAlso projectItem.ProjectItems IsNot Nothing AndAlso projectItem.ProjectItems.Count > 0 Then
            projectItemContainingType = FindProjectItemWithType(typeName, projectItem.ProjectItems)
        End If
        If projectItemContainingType IsNot Nothing Then
            Return projectItemContainingType
        End If
    Next
    Return Nothing
End Function
Private Function FindProjectItemWithType(ByVal typeName As String, ByVal codeElements As CodeElements) As ProjectItem
    Dim projectItem As ProjectItem
    For Each codeElement As CodeElement In codeElements
        If codeElement.Kind = vsCMElement.vsCMElementClass OrElse codeElement.Kind = vsCMElement.vsCMElementEnum Then
            If codeElement.Name.ToLower() = typeName Then
                projectItem = codeElement.ProjectItem
                Return projectItem
            End If
            Continue For
        End If
        If (codeElement.Children.Count > 0) Then
            projectItem = FindProjectItemWithType(typeName, codeElement.Children)
            If projectItem IsNot Nothing Then
                Return projectItem
            End If
        End If
    Next
    Return Nothing
End Function

Some shortcut to OpenType procedure (like Ctrl + o, Ctrl + t) and you are ready (I describe how to assign a shortcut in my previous article). It finds top level classes and enums. I have found that searching for inner types - like class or enum defined inside another class, makes it run very slowly - but that is nothing we cannot handle.

If you think you like working with macros and need a bit of practice, there is one thing that can be done that will speed things a lot: instead of searching the whole solution for a type, every time, just build a dictionary of typename/projectitem. That will make your searches lightning fast. Just keep in mind that you have to update this cache every time someone adds or removes types. This is not an easy thing to do! Not by far!s

kick it on DotNetKicks.com

Saturday, September 22, 2007 6:24:14 PM (Central European Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 

The one thing that I always miss in Visual Studio is a quick way to open a file that is part of a solution. By "quick" I mean not requiring a mouse action and with minimal amount of typing. It came out that it is indeed possible to do so without any addon's. As Robert Prouse shows in his blog entry on Quickly Find/Open a File in Visual Studio, we can do so by using the Find drop down (usually it can be found on a toolbar). You get there by pressing Ctrl + d or Ctrl + /. Also in the comments to his post, there is a hint, that we can use a Ctrl + Alt + a to open a command window where you can issue commands like "open [filename]". Cool things indeed. But there is more to it!

I decided to play a bit with Visual Studio Macros and see what I can come up with.

The first thing was writing a macro for opening a file. Functionality similar to the above mentioned, but implemented using macros (later I will write why I decided to reinvent the wheel). As it came out, the documentation on the subject is not very good. It hardly exists! So I had to experiment a bit and after a while I had it working.

To make a Macro step by step:

  1. Run Visual Studio
  2. Press Alt + F11 (or go to Tools->Macros->Macro IDE... menu item)
  3. Under MyMacros, add a new Module.

In the newly added module, start writing code. It is VB.NET so it may cause a little discomfort for a C# developer, but it shouldn't be a major problem.

My procedure for opening files looks as follows:

Sub OpenFile()
    Dim fileName As String = InputBox("Open file:")
    If String.IsNullOrEmpty(fileName) Then
        Return
    End If
    Dim item As EnvDTE.ProjectItem = DTE.Solution.FindProjectItem(fileName)
    If item Is Nothing Then
        MsgBox("File not found", MsgBoxStyle.Exclamation)
        Return
    End If
    item.Open()
    item.Document.Activate()
End Sub

When the code is ready, save it and return to the main instance of Visual Studio and set up a shortcut key.

Setting up a shortcut is easy:

  1. Go to Tools->Options->Environment->Keyboard
  2. Find your macro
  3. Set up a shortcut key (such as Ctrl + o, Ctrl + f) and press assign

From now on, you can use the macro.

The drawback of using this method for opening files is that it does not provide intellisense support, but we can do more with macros than just opening files... Just read my next post.

kick it on DotNetKicks.com

Saturday, September 22, 2007 6:06:32 PM (Central European Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [1]  | 
 Friday, July 20, 2007

For a couple of months now I've been running Windows Vista and Visual Studio 2005 without major problems (other than the commonly known ones). Since the first day of this setup I have been working on solutions that inlcude from one to many ASP.NET web applications. All of them are configured to use IIS rather than the built in web server. For all that time, everything was working fine until recently...

One of those days, while opening one of the solutions in Visual Studio, I was presented with a message telling me that my site is configured to use ASP.NET 1.1:

---------------------------
Microsoft Visual Studio
---------------------------
The site 'http://localhost/WebSite' is currently configured for use with ASP.NET 1.1.4322.573. Microsoft Visual Studio has been designed for use with ASP.NET 2.0; if not configured some features may make incorrect assumptions, and pages designed with the tool may not render correctly.

Would you like the site to be configured for use with ASP.NET 2.0?
---------------------------
Yes   No   Cancel   Help  
---------------------------

Needles to say that there were no changes made to IIS configuration of Application Pools or the pool the site is running on, but just to be sure, I've checked IIS Manager. The pool for the site was ASP.NET V2.0. I have agreed and allowed Visual Studio to make the "necessary" change. Needles to say, that nothing was changed in scope of application pools by Visual Studio. Fortunately, my solution kept working after that... for few days.

After few days I've got the very same message. Again, nothing was changed in IIS. This time I decided to leave my supposedly ASP.NET 1.1 in place. Of course everything worked after that also. Including debugging! But then I have the same message every time I open any of the solutions :-(.

I have found that other people also had this problem, and "aspnet_regiis -i" helped them, but it doesn't work for me :-(

Today I noticed that it gets worse. Now I get the message every time I open any of my solutions that include web sites :-(

Friday, July 20, 2007 2:05:07 PM (Central European Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [3]  | 
 Monday, July 09, 2007

There is a very useful feature in Visual Studio since I remember. It is accessible through Debug->Exceptions... menu item. It allows you to specify when you want the debugger to break. By default, it is when an exception is unhandled, but to make sure, everything works as expected, I often turn the when thrown option on. This allows me to detect all exceptions that are thrown in my code, even those that I handle but shouldn't.

Normally the Exceptions window looks like this:

But for some unknown reason, mine looked like this:

Notice that there is no User-Unhandled checkbox column. For some reason I just needed to have this column so I went searchin over the internet, and I have found that the reason for not having the checkbox column for User-Unhandled exceptions is the setting I have made in some other part of Visual Studio: Tools->Options...->Debugging->General->Enable Just My Code (Managed Only).

After checking the above mentioned option, the checkbox was back!

Monday, July 09, 2007 12:33:00 PM (Central European Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [1]  | 
 Thursday, July 05, 2007

Coming from MySQL and PostgreSQL background I am used to tools such as mysqldump for getting a complete dump of an SQL database into an a file. The file then contains SQL commands for creating the database structure and more importantly, for filling it with data using INSERT statements. A nice feature indeed.

Since I've begun working with Microsoft SQL Server, it has always been a problem for me to get the same result. There is no command line utility that I know of that comes with SQL Server 2000 that allows you make the same dump as mysqldump provides. There is however a hidden feature in the Enterprise Manager that you can use to achieve the more or less same result as with mysqldump. I have written about how to get the database schema using Enterprise Manager some time ago. The problem is that it does not work for SQL Server 2005 - there is no Enterprise Manager for v2005! The Microsoft SQL Server Management Studio does not have that useful feature so we are left alone... Or maybe not.

Some time ago I was determined to find a solution for this problem. So I have searched high and searched low, and I have found something. The thing is the Database Publishing Wizard. It does exactly what is needed - it dumps the schema, the data and even stored procedures if any are available! It has a command line interface, a GUI interface and on top of it it integrates with Visual Studio!

What more can you want?

kick it on DotNetKicks.com

Thursday, July 05, 2007 10:19:44 AM (Central European Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [2]  | 
 Wednesday, July 04, 2007

Everyone knows the using statement. The statement that deals with IDisposable interface for us in a clean to write way. There is however one feature of this statement that is almost never mentioned. The feature I'm talking allows for multiple objects initialization of variables. Usage looks as follows:

using (SqlConnection conn1 = new SqlConnection(), 
    conn2 = new SqlConnection())
{

}

This way, both conn1 and conn2 will be disposed - no need to write 2 nested usings.

There is a note about this feature on MSDN but I've not seen it mentioned anywhere else.

Wednesday, July 04, 2007 8:34:02 AM (Central European Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [2]  | 
 Tuesday, July 03, 2007

I cannot remember how many times I was entering the same piece of code over and over again with few (if any) changes. The piece of code that I'm talking about is an event handler method with a signature similar to the following:

protected void Accept_Click(object sender, EventArgs e)
{
    //....
}

The whole structure is method is usually the same. We have access modifier, a name of an object, an underscore, a name of an event and finally the sender and EventArgs part of which only three things tend to change.

Keeping this in mind I have created a code snippet that saves me a lot of time when I need to create event handlers manually (which usually happens when working with ASP.NET controls).

Some time ago I have written an instruction on how to use code snippets and also I have provided a couple of useful snippets. The new snippet added to the collection is used by typing "eventh" and it allows for customizing 3 parts of an event handler that are most likely to change.

kick it on DotNetKicks.com

Tuesday, July 03, 2007 10:01:48 PM (Central European Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [2]  | 

While working with some obscure Microsoft's technology called MPS (Microsoft Provisioning System) I've been presented with one of the best error messages ever: "The server is unwilling to process the request.". So now we have to ask servers if they are willing to help us? Huh?

Tuesday, July 03, 2007 6:36:13 PM (Central European Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
 Friday, June 29, 2007

Today while I was working on my usual solution inside Visual Studio I have encountered a serious problem with how Visual Studio, SourceSafe and Web Site projects interact. My solution that I was working with consists of several projects including few Web Sites. My environment is configured to use SourceSafe database as a version control system. Nothing unusual - a 100% Microsoft only environment. I had been working like this without any changes to the configuration for a long time but I noticed that no matter what I do, my solution file (.suo) is growing larger and larger...

Since .suo (solution user options) files only contain information about my options e.g.: opened files, break points etc I thought that it will not hurt much if I just delete this file. I didn't care about opened files nor the location of breakpoints. Besides, sometimes deleting the .suo file is just the only option to restore Visual Studio to a working state after it refuses to open a project file. On top of this, I have deleted the .suo file many times before without any negative effect. So I did again, but this time I was hit right between the eyes and I'm still recovering from the blow.

After deleting the file and starting the solution I got the following message:

"The Open from Source Control operation is still in progress but you can start working now. The rest of the projects will be retrieved asynchronously."

I thought, oh... OK, the message was not a warning and there are a lot of useless messages in Visual Studio so there is no need to worry. I was WRONG, but it came out some time later.

Everything opened correctly and it even seamed to work, but the pages looked different from what I was expecting. They looked exactly the same way as before I made my last changes that I didn't commit before the deletion of .suo file.

After a bit of investigating and testing I have found the problem. And the problem that is! It appears that if you have a file checked out inside of the Web Site project than the fact it is checked out is somehow remembered inside the .suo file. If you delete a .suo file then Visual Studio will try to be "smart" and will get the latest version of that file from the source control - SourceSafe in this case. What this means of course is that any changes in the checked out file will be lost WITHOUT ANY chance to stop and WITHOUT ANY warning message!!!

This issue is only a problem for Web Site projects. Other project types like Class Library are not affected. Now the questions are obvious: why Visual Studio is using .suo files to keep tract of what is checked in and what is checked out inside Web Site projects? Are .scc and .vspscc files not enough? Why would it even try to get the latest version? Is the fact that the file on the disk is not Read Only and is different from the version in the Source Safe not enough to at least issue a warring/question?

In my opinion it is obviously a bug and it has just caused me to lose half a day of work!

Friday, June 29, 2007 1:52:19 PM (Central European Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [1]  | 
 Friday, May 11, 2007

For a long time now I have been working with only one monitor. For a developer it poses some difficulties like lots of overlapping windows. Without even really knowing how it is really like I have always been an advocate of a dual monitor setup. Now when I have a laptop and an external LCD I can only say that I was right, but at the same time wrong!

Two monitors give you much more space on which you can put your windows. For instance you can put a help window on one monitor and the code on the other. If you work with ASP.NET you can have a browser running on one of the monitors while you edit the code on the other and take advantage of Edit and Reload feature. Possibilities are almost countless. Almost...

The one thing that I was wrong about is the fact that my primary development tool: Visual Studio 2005 does not support dual monitor setup! Can you imagine? The only support available is that you can move SOME of the windows on to the second monitor. The windows you can move include Solution Explorer, Watch, Immediate and all the other dockable windows. Good as it is, I think it is only a side effect of those windows being draggable. The problem is that Visual Studio was never intended to be used on more than one monitor and that is why you cannot move the most important windows to the second monitor. What are the most important windows? For me it is the code window and the design window (ASP.NET).

At first I thought that I might be missing something. Some switch in the preferences. Unfortunately it is simply impossible according to the following sources:
http://blogs.msdn.com/saraford/archive/2005/07/20/441126.aspx
http://blogs.msdn.com/saraford/archive/2004/05/18/134295.aspx

That's a pity. I cannot wait for the next version of Visual Studio in hope that they will add the support for more than one monitor.

Friday, May 11, 2007 2:10:31 PM (Central European Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [2]  | 
 Tuesday, March 20, 2007

From time to time I need to find out if the code that is currently executing runs in a Hosted Environment (like ASP.NET application) or not (like Windows Forms application). Mostly those kind of knowledge might be needed in reusable assemblies which deal with file access. For ASP.NET application you almost always need to call Server.MapPath method (or one of the equivalents). For Windows Forms Application you either do nothing or call something like Application.StartupPath.

There are many ways to tell if code is hosted or not. Usually I see code similar to the following:

if (HttpContext.Current == null)

This code however requires a reference to a System.Web.dll which may not be something you take lightly :-). So I thought: lets see how They do it - that is how Microsoft does it.

It appears that they use a System.Web.Hosting.HostingEnvironment.IsHosted property to make this check inside System.Web.dll. Still this is a System.Web.dll that you have to reference to make the check. I have been unable to find any alternative that does not require this reference, but hey! I'm a web developer mainly and I have nothing against referencing System.Web.dll :-)

Tuesday, March 20, 2007 11:11:26 PM (Central European Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
 Monday, March 19, 2007

I have always believed that each collection is by definition IEnumerable. That belief held true until today...

First let me define my loose definition of what a collection is. A collection is a set of objects. In .NET Framework I have noticed a special pattern for naming collection classes - they usually end with a Collection word. Examples include dozens of collection classes in System.CodeDom namespace, AttributeCollection or even ControlCollection. I'm so used to this kind of naming convention that when I see it I automatically know that I can do a foreach loop over it.

There is however at least one exception from this rule and that is a System.Web.UI.CssStyleCollection class. It is a class that derives directly from System.Object and it does not implement any interface which means no IEnumerable!!! When I looked at the public properties, they suggest that it should really be a collection. It has an indexer, it has a collection of keys and values. It even has a Count property not to mention all the usual methods for manipulating collection-like objects.

Strange, but true :-)

 

Monday, March 19, 2007 4:56:11 PM (Central European Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [2]  | 
 Tuesday, March 13, 2007

There are a lot of articles on how you can debug you JavaScript code using Visual Studio 2005. There are basically two cases:

  1. Debugging ASP.NET pages inside the Visual Studio's solution.
  2. Debugging other pages - not included in the solution.

In the second case, all you have to do is attach to a process of a running Internet Explorer using Debug->Attach to Process... menu option, in the first case, all you need is to run the solution in debug mode.

The rest of the scenario is the same for both cases. Visual Studio allows you to open any script document currently loaded into the Internet Explorer process you are currently attached to. This is done via the Script Explorer window which you can turn on using Debug->Windows->Script Explorer menu option or by using the Ctrl + Alt + N keyboard shortcut. The window should look more or less like this:

The problem is that more often than not, debugging JavaScript in Visual Studio simply does not work! I have spent countless hours trying to find the solution or even the cause of this problem, but without success. There are many "solutions" on out there but none of them really solves the problem. Most of them simply don't work! Probably Microsoft fails to acknowledge this as a problem since it has been around for few years now - judging by the news group posts dates.

Tuesday, March 13, 2007 9:32:03 AM (Central European Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [2]  | 
 Friday, March 09, 2007

There is a bug in Visual Studio 2005 (but I think I have also seen it in Visual Studio 2003) that causes multiple break points to be set in case you have few files with the same name opened using Script Explorer window. (if you are fortunate enough to have it working).

Steps to reproduce the problem are simple. Just ran a simple page with a Textbox and a Button control and some kind of Validation control. This will ensure that the presence of two "WebResource.axd" JavaScript includes: one for with Validation code and the other one - the standard ASP.NET one. Try to set a breakpoint in the first line of any of the script files included. Use Script Explorer window to get the files. Notice that the breakpoint appears in both files. Also sometimes the focus is moved to one of the other files. Imagine having a couple of scripts included in such a way and all those unneeded breakpoints!

As mentioned above, I have noticed this behavior also in Visual Studio 2003, but I have not tracked it down. I'm almost sure however that there was also the same type of problem also with normal files included in the solution. (yet again, I can't remember for sure).

Fortunately removing breakpoints works correctly so you can remove unnecessary breakpoints once they are created.

As a side note. While writing this article my Script Explorer windows stopped working and this also means that script debugging inside Visual Studio also does not currently work, so I'm unable to provide any more details. I hope though that Microsoft will correct this problem sometime in the future.

Friday, March 09, 2007 5:45:48 PM (Central European Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
 Tuesday, February 06, 2007

Last time I have posted my observations on the Remember Password feature of Microsoft SQL Server Management Studio. Today it got even worse! Not only MSSMS forgets my password on a random basis, It prevents me from logging in with a correct password! Yeah I have written about it last time, but this time I have entered the right password - 100% sure of that, and despite dozens of connect attempts it always said that login or password is incorrect! So I have retyped the exact same password and voila, after second connect attempt it worked.

Now. I know that there is SQL Server 2005 service pack comming out soon, but does anyone know if the login window will be fixed? Come on! Its only a UI with few imputs! How hard can it be?

Tuesday, February 06, 2007 11:29:32 AM (Central European Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [2]  | 
 Wednesday, January 24, 2007

Today I have found a funny example of how to ensure the checkbox is not visible:

<input id="chkIsDirty" type="checkbox" readonly style="DISPLAY: none;
VISIBILITY: hidden; BACKGROUND-COLOR: transparent" size="0" runat="server"
name="chkIsDirty">

I have emphasized the important elements. I wonder if it is also hidden by the style sheets and maybe in the code via the runat="server" attribute :-)

Wednesday, January 24, 2007 3:23:10 PM (Central European Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [3]  | 
 Thursday, December 21, 2006

I have found a post on Web Development Team's blog providing SOME information on what was changed/fixed with the new Service Pack. There is also another post on Scott Guthrie's blog on the same topic. Good!

But wait! Am I really expected to look all over the Internet and gather pieces of information just to build a list that SHOULD be available in a KNOWN and EASILY ACCESSIBLE location? You got to be kidding!

Thursday, December 21, 2006 8:33:04 AM (Central European Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 

For some time now I have been having problems with "Connect To Server" window of Microsoft SQL Server Management Studio. The standard problem is that has problems remembering the password, or rather it has a habit of forgetting. The effect is that each time I run the MSSMS, there is a chance that my password will not be there even if I have checked the check box to remember it before. I'm currently running Windows 2003 Server, but I had exact the same problem on Windows XP.

Over a time I've got used to it and I no longer bother to check the "Remember Password" check box. Today however I have began to have a new suspicion.

Almost every time I try to log in to the server for the first time, I get a message that login or password was incorrect. I have always reentered my password thinking that I had made a typo. Some times it took me three times to get it right and that made me think.

Why is that window different? When I use the same password for other windows, my success/error rate is almost zero. Here I'm far from that. So I've investigated the issue.

The goal was simple: after entering a user name and password and getting a failed login attempt saying that the user name or password was incorrect, check if the message is right. Options were just to retry without changing anything or compare the entered text with what should be entered.

The first method was too easy :-). So I have decided to see what's in there. User name was a plain text so it was easy. And since it IS remembered, I have confirmed no error there. As for the password. I have used the Runtime Object Editor, to look under the hood. And guess what? Password was also correct!

Given the investigation I can say with certainty that there is a bug in the MS SMS! Such a simple function and it doesn't work!!! I have found one similar bug report. Not exactly the same but I think it is somehow connected. Imagine that. Big company, lots of money, lots of time, one small window and so many bugs!

kick it on DotNetKicks.com

Thursday, December 21, 2006 12:41:53 AM (Central European Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [6]  | 
 Tuesday, December 19, 2006

Now I have a brand new Visual Studio 2005 Service Pack 1 installed. I'm happy with it, but I would be even more happy if I knew what was fixed by the installation. And so I went searching.

After a while, I just gave up! It is just to hard for me to accomplish the task of finding some kind of change log for the Service Pack 1! What I have found were Visual Studio 2005 Service Pack 1 release notes. On this page hidden in the summary section, just before a list of requirements and a very long list of installation issues, there it was, the link to What’s New in Visual Studio 2005 SP1. I have followed the link.

On the destination page one thing caught my attention - the topic: "What's New in Visual Studio 2005, This topic has been updated for Visual Studio 2005 SP1". Scrolling down a little, confirmed my suspicions. It is not a list of new features or bug fixes that were distributed with the new Service Pack 1. It is an overview of features the Visual Studio has now, after you install SP1. More Over! Look at the "New in Visual Studio 2005 SP1" section!!! Its empty.

I don't suppose that Microsoft is so evil not to provide some kind of change log. I only know that they just cannot make their own website usable and put the interesting things somewhere where people can actually find them. So, if anyone knows where can I get the list of features introduced with the new SP1 and the list of bug fixed, I would be grateful if he shares the knowledge.

kick it on DotNetKicks.com

Tuesday, December 19, 2006 7:52:33 PM (Central European Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 

One more time Microsoft has proven that they just cannot do things right. This time it's all about the newly released Service Pack 1 for Visual Studio 2005.

I'm certain that most of the developers working with Visual Studio 2005 know about the fact that the Service Pack has just been released. If not, at least they are aware of the fact that Microsoft was planning to release the product for some time now. So now it has been released. Are you ready to install it? Try! I have tried and it was not an easy task!

When first I have read that it is available I didn't think long before I went to the www.microsoft.com site. There I have used the search function in hope ... I don't even know what I had hoped for, given my previous experiences with searching Microsoft's site using Microsoft's search engine. The search results were disappointing yet not surprising - couldn't find it:


I have even tried to exclude the "beta" word, but with no better effect:

So, as usual, when I need to find something on Microsoft's site, I used Google (!!!). No surprise here, first result - a hit:

Having the page I went downloading. After starting the download I was presented with a funny page telling me that people who have downloaded Visual Studio 2005 Service Pack 1 have also downloaded ... Visual Studio 2005 Service Pack 1. What a coincidence :-)

After few hours of download (it has 450MB) I could finally run the setup and wait for few hours (or so according to the information on Microsoft's page) until it installs .

I had the setup procedure up and running and. Oh no! They have worked too long on this product to just let it install in like that! After a couple of minutes of waiting I've been presented with an error message Error 1718 some file did not pass the digital signature check:

What's going on? I'm sure most of us don't bother to read the installation procedure on the download page, especially as it is presented below download button, after clicking which you are redirected to another page, but there there is an information that such a problem may occur. Unfortunately, until you try installing SP1 on your concrete system, you don't know if you need to follow the procedure and by that time you have already lost a dozen of minutes. After pressing OK - the only available option, the Setup Procedure went through the same steps as before - i.e.: I had to agree to the same license terms etc. This time though it took more than ten times the amount of time just to inform me about the same problem once more!

After following the procedure I was finally able to install the service pack, after wasting a lot of time on it.

BTW: Since I haven't changed anything in my default Windows 2003 installation it seams to me that many people will have the same problem with the new Service Pack as I had!
If I count the time I have spent on trying to install the Service Pack and multiply this by the number of people that might have the problem I get a rather big number. Who is responsible? (Again! Last time it was because of IE7 that many people lost a lot of time because of the problems installing it and yet more (all) suffered from incredibly long installation time not to count few restarts and 2 validations during the process).

The question remains: why Microsoft, given all its resources, can't make it right the first time? (or second for that matter). Why they have to have everything so tightly integrated in to the operating system (like IE)? It is like if I had a house and my TV was integrated with it!

kick it on DotNetKicks.com

Tuesday, December 19, 2006 7:39:58 PM (Central European Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [1]  | 
 Thursday, December 07, 2006

In my recent article on Immediate Window, I have showed how you can use it to debug your application, but also how to run arbitrary code. Working with Immediate Window has one major drawback: it requires a lot of typing without any kind of support from the IDE. There is however an alternative way to call your methods using Visual Studio: Object Test Bench.

Object Test Bench as the name suggests is used to test objects. It has a simple visual interface that makes it easier to work with than with Immediate Window. For example if we have a class:

public class SomeType
{
  public string SomeMethod()
  {
    return "return value"
  }
}

Then we can add an instance of this class to the Object Test Bench, and execute any of its methods using context menu as on the picture below:

 

If method that is to be invoked requires parameters, Visual Studio will display a special dialog box where you can enter appropriate values - or select them from the list of other objects if necessary. Also, if the method has a return value, the result will be added to the Object Test Bench as a new object on which you can also invoke methods.

To use the Object Test Bench, go to the Class View (ctrl+shift+c), navigate to a class you want to test and from the context menu, select "Create Instance" or "Invoke Static Method" depending on what you are trying to test. You can also access the same functionality through the Class Designer (Class Diagram).

As good as the Object Test Bench may appear to be, there are also some major problems with it that in practice make it useless - at least for me.

The first and most serious problem that disqualifies the bench is the fact that any time you make a change in the code, the whole object structure is deleted from the bench. Just imagine spending couple of minutes setting objects up just to find out that one of the method requires changes. After you make the change, you have to set the whole bench from the be