Rick van den Bosch - Blog

... on .NET, software architecture, software development and whatnot

Recent Posts

Tags

News

  • Live space

    Photo blog

    Follow me at twitter

    Rick  van den Bosch

    LinkedIn profile

    Add to Technorati Favorites

    Disclaimer
    The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Community

Email Notifications

Blogs I read

Interesting links

Archives

June 2005 - Posts

Did you know... Visual SourceSafe "Keyword Expansion Support"

Although we're not using SourceSafe at my current project (yet), I found out about a cool feature recently: Keyword Expansion. It enables you to get information about the revision, date, author and so on of the version of the file you are looking at inside the file itself. This way you can see version information in the comments of your code-file, without even starting SourceSafe.

Taken from an MSDN entry about VS2k5:
Visual SourceSafe supports keyword expansion, a process that enhances with version-specific information certain keywords that you place in your text and HTML files. When you add or check in a file that contains these keywords, in comments, Visual SourceSafe looks for the keywords and automatically places relevant version-specific information after them. For example, the string $Revision: $ tells Visual SourceSafe to expand the Revision keyword automatically with the current file version number.

Read this entry (SourceSafe 6 also supported) for more information and a howto...

ComboBox trouble

The default ComboBox has some weird characteristics...

We created our own control which derives from the ComboBox because we wanted to create a ComboBox where the user could type (parts of) the value he or she wants to select, but would not be able to type something that was not in the list. So that’s kind of a combination between the DropDownStyles DropDown and DropDownList. The basics weren't that complicated, so we created the controls pretty fast. But then came the next step: fine-tuning.

For instance: when you change the selected index of a ComboBox in code while it is dropped down and then set DroppedDown to false, the index is not the value to which you set it in code. But the text is set to the text of the item you set the index of! Because of this, the control shows the right text, but when you read that property, you get a different value. All of this while the Selected Index Changed event fires when you set the index in code...

So in stead of setting the selected index while the ComboBox is DroppedDown, you should set DroppedDown to false, change the selected index and then set DroppedDown to true again (if necessary). We encountered some more of this weird stuff, like this:

Setting the selected index to -1 doesn't always reset your ComboBox. When you set the selected index to -1 twice, it works... :S
Also see this post on MSDN Library about that.

Have you got some weird stuff about the .Net ComboBox? Drop a line in the comments.

HOWTO: display your assembly @ Add Reference

You might want to be able to let your assembly show up in the Add Reference window in Visual Studio without the user having to browse for it. When you install your assembly in the GAC, it doesn't automatically show up in the Add Reference window, because it doesn't enumerate all assemblies in the GAC. Installing in the GAC only eliminates the need to copy assemblies localy when referencing them. Microsoft doesn't recommend putting assemblies in the GAC by the way...

You can add your assembly to the Add Reference window by editing the registry. First, make a new key (name not important, I'll use 'GumpsBlog') in the following subkey:
HKCU - SOFTWARE - Microsoft - .NETFramework - AssemblyFolders

Then, in the key you created, let the default value point to the location where your assemblies can be found. This should look something like this (sorry for the Dutch interface, click to enlarge):

Next, restart Visual Studio and see your assemblies in the Add Reference window!

By the way, placing this registry key under the HKLM makes the assemblies in the specified folder available to any user, not just the current one...

A failure occurred writing to the resources file. The system could not find the file specified.

We received the above error for the resx file of a form in our project today. So we checked the existence of the resx file it concerned, and it was there. So maybe the file was corrupt? We deleted the file, removed it from the project and let Visual Studio re-create it by editing the form in the designer. Building the solution gave the same error... again the file was right where it was supposed to be.

Next we deleted the file and then built the solution: this worked! But why? And would it still work when we edited the form in the VS designer? The answer to that last question is: nope. As soon as the file was created by the designer the build error popped up again.

Searching MSDN Library did give me this topic, but that doesn't give a satisfying answer because it only describes the error. So, I ‘Google grouped’ it.  Eventually, this lead me to this post. In short it says:

The limit to project names (including their fully qualified path) in VS.NET is 258 characters. (…) I suspect, however, that you are running into a name length issue. The 258  character limit on the length of path names is something we've received feedback on before (…). As a result, we are looking into this problem for fixing in the future.

 

Thanks,

Allen (VS Core Team)
 

I tested some stuff and found out that building a solution which is in a 218 character directory structure and includes a form called ‘form1’ builds ok in debug configuration, but not in release configuration. Shortening the directory structure with one character solves the problem there. Form1.resx counts 10 characters. Add this to the 217 we had for the directory and you get 227. So that might be the magic number.  But that doesn’t explain why building debug works, while building release doesn’t. Of course, release is a longer word than debug, but the error occurs on the resx file in the application root which is not influenced by the configuration of the build you are making. Maybe VS creates temporary files and these break the build process?

Anyway: keep away from 200+ directory structures (and ridiculously long filenames) and you will be fine…

Microsoft releases 'Acrylic' beta

Microsoft has released a beta for the program codenamed 'Acrylic'. According to some people this might be Microsofts attempt to compete with Adobe, because it is said the program is the ideal combination of vector based graphics (Illustrator) and pixel based graphics (Photoshop). Is this Microsofts answer to the domination of Adobe in the graphics department?

I downloaded (free) and installed it today, but I haven't had time to check it out. I have seen it supports all major formats for opening and exporting. You can find the Acrylic site here. Tell me what you think about it ...

A custom SOAP fault handler and a 'Reference not set to an instance of an object' error ...

Today we had a problem on the project I am working on. To be more precise: I had a problem, the other team members did not.

Quick explanation: We have a server component which uses a web service for some of the functionality we need. Other functionality can be found in a different system which is reachable through IBM WebSphere MQ. The server component is available through remoting, the objects are hosted in IIS. To get decent SOAP errors someone on the team created a custom SOAPFaultHandler and included it in the web.config of the server component. So far so good.

When trying to request a typed DataSet at the front end application all the way from the web service (so through the remoting objects of the server) I got a 'reference not set to an instance of an object' error. Strange, because nobody on the team mentioned anything about this and it concerned key functionality. Stepping though code I found that the web service worked decently: the typed dataset was returned successfully to the server. Stepping further, the server component looked OK also: the dataset was available everywhere up to the Service Interface layer (facade layer). But still I got that same error at the client application...

Finally, after some intense debugging, I got to the SOAPFaultHandler and decided to attach that to the aspnet_wp process to see if that might cause the problem. And it did! There was a check on the existence of the header, but it was not checked for items: the first item was read without checking for existence. That caused my version of this complete system to break.

I corrected the error and things were fine, but I couldn't find a reason for this weird behaviour. Why did I have the problem but no one else? I think I figured it out when I found out everybody had WSE 2.0 installed, except me. It looks like WSE 2.0 fixes something around SOAP errors so there aren't any when they are not necessary, or the ones that are there are complete ones. We had a deadline today, so I didn't investigate any further. But I think I’ll try to find the real reason the following week. And when I find the true reason, I'll keep you posted.

Tabbed browsing in IE6
Although I don't like Internet Explorer toolbars at all, I'm thinking about installing one. MSN toolbar V1.2 now gives your IE5.1+ browser the cool feature of tabbed browsing. This IE7 preview kind of thing is available for download together with Windows Desktop Search functionality and some more stuff. Read about the functionality here, or just get it.
Visual Studio .NET Bootstrapper

Have you ever made an install for your application with Visual Studio and sent it out into the world, only to get complaints of people that your software wouldn't run?
“Have you got the Microsoft .Net framework installed?”
“The what?”
“Go look in control panel, ...... ......”
“Ow, yeah, I got that”
”Hmmm....”
”So ehm....”
”What version is it?”
”Version? .... wait .... it's 1.0”
“Darn, download it and ...”

And so on and so forth. And that is not cool. That's why some people have made the Visual Studio bootstrapper. Read about and get it here, install it and enjoy...

Controls disappear from the Windows Forms Designer in VS2k3
We recently ran into the problem mentioned in the title of this post at work. Microsoft has a knowledgebase article (kbid 842706) for this bug. The hotfix is not to be distributed freely, but I already spoke to some people who have contacted Microsoft and got the fix for free. It will be e-mailed to you.

As you can read in the comments of this post at dotnetjunkies, there are some people who found no more problems after installing hotfixes KB841870 and KB841767-X86... I think that's weird (but I'm not arguing!) because these two articles are about Crystal Reports and the rearrangement of controls, not the removal of them. But hey, we'll give it a try!

There is a more easy solution, however. Most of the time, this kind of behaviour is common for user controls which reside in the same solution as the rest of the project. By removing the user control from the main solution and placing them in their own separate solution, the problem can often be resolved. Just add a reference to the output of the project in the separate solution, and most of the times your control will stay where it's supposed to stay. If that doesn't help: try contacting Microsoft for a hotfix...