DevExpress DXGrid for WPF and Visual Studio Express

Turns out that the DevExpress installer does not integrate DXGrid with Express editions of Visual Studio. Solution is:

1.Manually add references for following assemblies:
DevExpress.Data.v9.2.dll
DevExpress.Wpf.Core.v9.2.dll
DevExpress.Wpf.Editors.v9.2.dll
DevExpress.Wpf.Grid.v9.2.dll

2. Manually add namespace to XAML:
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"

You can then add your element as usual.

DevExpress Support also say that you can manually add the following assemblies to the Toolbox to achieve designer support, but that didn’t work for me:
C:Program FilesDevExpress 2009.2ComponentsSourcesDevExpress.DLLDevExpress.Wpf.Editors.v9.2.dll
C:Program FilesDevExpress 2009.2ComponentsSourcesDevExpress.DLLDevExpress.Wpf.Grid.v9.2.dll

Tip: Shared Assembly Attribute File

When you on a solution with several assmblies in .NET, you’ll find yourself maintaining multiple copies of AssemlyInfo.cs, each of which contain a lot of common attributes such as:
AssemblyCompany
AssemblyProduct
AssemblyCopyright
AssemblyTrademark
AssemblyCulture

You may also wish to make AssemblyVersion uniform accross your build.

A useful technique in this situation is the following:
1. Copy the common attributes out into a new file, called something like ‘GlobalAssemblyInfo.cs’
2. Delete these common attributes from the original AssemblyInfo.cs files
3. Save your GlobalAssemblyInfo.cs file somewhere useful, e.g. in the same folder as your solution file
4. In each project, add GlobalAssmblyInfo.cs through the IDE as a linked file, rather than a straight addition.

Breakpoint conditions

Just started using these in a large project I am maintaining – very useful for working with event sinks that get called every time *anything* happens.

School boy error for the day was thinking in VB rather than C# for my loop condition: ‘i=6’ has changed rather than ‘i==6’ has changed
Assignment never changes, as I found, waiting in vain for my debug window to appear!

VB6 Crashing on Opening

Had a problem with VB6 crashing immediately upon opening. Tried rebooting, running in Windows Safe Mode, no joy. Fixed after an hour searching the news groups – turns out the procedure is as follows:

1. Try logging in as a different user. If VB6 runs, you have corrupt registry settings. Replace your own settings with those of the user that works, from
HKEY_CURRENT_USERSoftwareMicrosoftVisual Basic6.0

2. Try disabling all addins manually. (Apparently this is often the problem). To do this:

To disable Add-ins manually, make backups, then set all values to 0 in the following file:
C:WINDOWSvbaddin.ini

Also, set all LoadBehavior for all Add-ins to 0 for the following key in the registry:
HKEY_CURRENT_USERSoftwareMicrosoftVisual Basic6.0Addins

All of this information came from an invalulable post here:
http://groups.google.co.uk/group/microsoft.public.vb.general.discussion/msg/6f718cded4158bcb?dmode=source&hl=en

IIS and 403.1 Error

Today I was tormented by the following error from IIS:
HTTP 403.1 Forbidden: Execute Access Forbidden

I checked the directory security permissions in Windows, gave everyone under the sun god-like permissions on the whole folder tree, checked anonymous authentication, checked the server logs … but still this error came.

It turns out it was because I had “.com” in the folder name – something it would have taken a couple of months to figure out without Google:
Forum post on Velocity Reviews (new window)

NET USE Syntax

Not very exciting, but lesson learned today:
NET USE D: [MY PATH] * /USER:[USER NAME] /PERSISTENT:NO

The asterisk means I’ve stopped locking my NT account out every week or so, since it prompts for a password, rather than trying to log in without one, failing, and then prompting me.

Regex.Replace, $ and $$

Just hit an interesting problem with the replacement argument of Regex.Replace. The issue was that I was passing in variable content to this argument, and it turned out that dollar signs could occur in the content I was passing in. These were interpreted as backreferences, which gave me very different results to the ones I was expecting.

With hindsight, this is kind of obvious, and the solution is simply to replace any single dollar signs in the variable content with repeated dollar signs, as described here:
MSDN on Replacement Substitutions (new window)

See if you can spot any whiff of this looking at the documentation for the method though:
MSDN on Regex.Replace(String, String, String, RegexOptions) (new window)