Adding a dictionary for the CodeRush spell checker

By Mike Hanson at September 25, 2010 18:01
Filed Under: CodeRush, Visual Studio

As a long time CodeRush + Refactor Pro user I was pleased when DevExpress added a Spell Checker plugin, I was even more pleased when I opened the options page and saw I could change the culture to English (United Kingdom).  However my joy was short lived when I discovered that changing the culture effectively disables spell checking.  For a while I just switched it back to English (United States) and lived with the irritating differences, but finally I got fed up and decided to figure out how to get the spell checker working for proper English.  What I discovered was that changing the culture is not enough, you actually have to install a dictionary that matches that culture.  So when I select English (United Kingdom) in the culture list the spell checker is looking for a dictionary with the name en-GB the standard code for the UK culture.  One option would be to take the standard en-US dictionary and modify it, but I also discovered that CodeRush supports the Open Office dictionary format, so I went off in search of one to install.  This article describes the steps to download and install an Open Office dictionary with CodeRush.

Silverlight Testing with WebAii UI Automation Fx

By Mike Hanson at September 23, 2010 04:19
Filed Under: Testing

I've been doing quite a bit of automated UI testing at work lately and learned a lot about something that only has basic documentation so I have started working on a series of articles that I hope will help others.

The introductory article is at http://www.borntocode.co.uk/page/Silverlight-Testing-with-WebAii-UI-Automation-Fx-.aspx

Silverlight cross domain WCF calls with VS WebDev.WebServer.exe

By Mike Hanson at September 18, 2010 20:54
Filed Under: .NET, WCF

This one had me stuck for hours earlier this week, and judging by the number of posts on forums plenty of other people are suffering the same, so I hope this little titbit saves someone the frustration I suffered.

I am using Visual Studio 2008 to create a Silverlight 2.0 (beta 2 at the moment) application. In my solution I have two web site projects, one for hosting the application, the other to host WCF services.  All I want is to hit F5 and have both sites run in debug mode and my SL app call my WCF services and work.  So I set my projects up as I believed they should be via the properties sheet for the project root as follows.

  • Disabled dynamic ports so I know the fixed address of the WCF
  • Remove the virtual directory name to make both root applications
  • Add the following clientaccesspolicy.xml file to the root of the WCF site (wide open for now)

<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
  <policy>
   <allow-from>
    <domain uri="*"/>
   </allow-from>
   <grant-to>
    <resource path="/"
        include-subpaths="true"/>
   </grant-to>
  </policy>
</cross-domain-access>
</access-policy>

So having written the code for my SL app to call my WCF service, references and all that stuff working fine I expect it all to work, I hit F5 in VS 2008 and both sites run, I can browse to the .svc file and get a working web page telling me how to create a client but in my SL application I get an error when I hit the button to call the service.

WTF? double check, triple check, hours of googling to make sure I have done it right, that my clientaccesspolicy.xml file is right still not working.  I read hundreds of blog/forum posts and articles and still no clue.  Many talked about problems with WebDev.WebServer.exe not having a root to place the policy file in but I had that covered you can change it in the properties sheet for the project.   Still no luck.

Just when I was about to give up and wire my project up to IIS I re-read an article that I had spotted earlier about "Self Hosting" WCF services in a Windows Service and what was required in the policy file to support this.  Light bulb moment, WebDev.WebServer.exe may not be a Windows Service but it is effectively a "Self Hosting Process", a quick change to my clientaccesspolicy.xml file and bingo it works.  What did I change?  Look below at the attribute in bold on the <allow-from> element.

<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
  <policy>
   <allow-from http-request-headers="*">
    <domain uri="*"/>
   </allow-from>
   <grant-to>
    <resource path="/"
        include-subpaths="true"/>
   </grant-to>
  </policy>
</cross-domain-access>
</access-policy>

So make this note in your little black book:

When it comes to web services (WCF or ASMX) WebDev.WebServer.exe is a Self Hosting Process and any requirements for self hosting apply.

Clean Namespace AddIn

By Mike Hanson at September 18, 2010 20:50
Filed Under: Visual Studio

One of my pet hates about Visual Studio is that it assumes that you organise folders in projects according to namespaces and adds folder names to the namespace declaration for classes.  Worse still there is no way to turn this behaviour off.

Usually I get by this by adding my classes to the root of the projec then dragging them to the relevant folder, and I strongly suggest that developers working for me do the same.  This week I came across a developer who complained about this and come up with reasons based around the lack of tool help if they forget to do this, so I decided to write an addin that automagically sets the namespace declaration of new C# classes added to match the Default Namespace setting in Project Properties.  I have called it Clean Namespace and published it on Visual Studio Gallery

No commands, menus or UI it just detects when a new C# class file is added to your project and changes the namespace declaration.  You can turn it off simply by disabling the addin via Tools, Add-in Manager...

Download Clean Namespace Visual Studio Installer

Change of domain name

By Mike Hanson at September 18, 2010 20:45
Filed Under: Commentary

Whilst I still retain my original domain name mikehanson.com the domain name and email address particularly have become a target of so much spam I got fed up of trying to protect it so decided to find a new domain name that communicates my passion for what I do.

I have migrated some of the content from mikehanson.com but have not bothered with the NavFx stuff as this is now defunct since Silveright 3 was introduced with a built in navigation framework.

Change of Blog Engine

By Mike Hanson at September 18, 2010 20:42
Filed Under: Commentary

Originally I chose Subtext for my blog, but recently I have found that other .NET blog engines have improved more and after reviewing the orginal set and some new ones I have settled on BlogEngine.NET.

Welcome

By Mike Hanson at September 18, 2010 20:39
Filed Under: Commentary

Welcome to my blog.  Anyone who knows me will be really surpised to find I have a weblog, whenever the subject came up I always said "I can always find something better to do", but lately I have been learning so much new stuff particularly with VS Extensibility (VSX), WPF, XAML, Rx and Silverlight that exited me enough to want to tell someone about it.

With VSX particularly I learned so much by piecing together little titbits from all over the place I actually sat down and started to put together a book, I actually wrote the first few chapters in between contracts, but then I thought about it and decided a book took up too much time so after some time looking around at other ways to document what I was learning it dawned on me that this is exactly what a weblog is for.

Of course the next decision was where to blog, do I use one of the many shared sites or do I set up a private one on the dedicated server I maintain for web sites.  It occured to me then that I hadn't updated my personal web site for a long time and it might be a good idea to replace it with a blog.  Of course then I had to decide on which blog engine to use.

Since I work exclusively with .NET technologies it seemed wrong to use anything other than a .NET blogging engine.  I googled for ".NET Blogging Engine"  and found a few, I downloaded half a dozen and set them up on my local machine.  To cut a long story short I found most of them didn't work as expected or at all but I found Subtext "did what it says on the box" and provided all the functionality I wanted.  It was easy to set up with a slick UI that fired up the first time I browsed the site and it just works as expected.  My second choice was dasBlog but this lost out on the setup procedure which was effectively a manual process.

Anyway welcome again to my blog, I will be using this like a "black book" to document what I learn about the technologies I work with and if anyone finds it helpful then it was worth the effort.

Mike Hanson

Tag cloud

Previous Articles