RuleDescription throwing exception in constructor when passed RuleName in 3.8.2 (worked in 3.5.1)

RuleDescription throwing exception in constructor when passed RuleName in 3.8.2 (worked in 3.5.1)

Old forum URL: forums.lhotka.net/forums/t/8924.aspx


rsbaker0 posted on Thursday, May 13, 2010

I'm trying to construct a RuleDescription for a broken rule and getting this exception:

 System.UriFormatException occurred
  Message="Invalid URI: The hostname could not be parsed."
  Source="System"
  StackTrace:
       at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
  InnerException:


The rule name has some sort of format that looks like this:

"rule://Csla.WORMapper.WORMapperBusinessBase%601%5B%5BCompany.Application.Data.EMPLOYEE%2C%20CMDATA%2C%20Version%3D9.1.20423.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull%5D%5D/KeyChangeNotification/Id"

I'm not sure what changed here as I thought the rule format looked more straightforward in the 3.5.1 code.

The same rule in my 3.5.1 build looks like this:

"rule://KeyChangeNotification/Id" 
 

EDIT: I see the code was changed to include the full declaring type name, but even changing it to use the short type name doesn't work. It chokes on this also:

rule://WORMapperBusinessBase%601/KeyChangeNotification/Id

I think the problem is the generic type names have the `  (reverse single quote if that doesn't show up) character in them and maybe those aren't valid in host names.

RockfordLhotka replied on Thursday, May 13, 2010

I'm sure you are right about the ` character. I think the value is encoded, but there's a different encoder required to catch that. Or maybe I had to write some extra manual encoding. In any case I know I hit this in the v4 code and had to fix it - didn't know it occurred in 3.8 code though...

Copyright (c) Marimer LLC