Wah On Terra .NET: Martin Granell's Blog

Attacking the scary bits in .NET

Home Contact Syndicate this Site (RSS 2.0) Syndicate this Site (Atom) Login
  29 Posts :: 0 Stories :: 68 Comments :: 3210 Trackbacks

Archives

Post Categories

Readify Blogs


This post and comments can now be found on my new blog here

One of the bugs in Enterprise Library v1.0 relates to Type validation.  The problem occurs when selecting a type from an assembly which is not in the Global Asssembly Cache, and not in the EntLibConfig.exe directory.

Example steps to reproduce are:

·         Create a project with a custom authorization provider (i.e. derive from ConfigurationProvider, and implement IAuthorizationProvider).

·         Add an application configuration file.

·         Build the app.

·         Run enterprise library, and open the application configuration file.

·         Add a Security Application Block section.

·         Add a Custom Authorization Provider.

·         Click the ellipsis on the type name.

·         Add the application assembly containing the custom provider type

·         Select the new type.

·         Attempt to save.

 

At this point you will receive a validation error stating that the type is not valid. The problem is that some of the configuration settings have the [TypeValidation] attribute, which will attempt to check that the assembly qualified name of the type is a valid type. Unfortunately, this is running in an App Domain which is rooted in the EntLibConfig.exe directory, and so will only be able to resolves types in assemblies in that directory, or in the GAC.

 

The longer term solution is for the TypeValidation attribute to be able to look in the correct assembly locations, but at the moment you will need to change the enterprise library source.

 

Open the file: <Program Files>\Microsoft Enterprise Library\src\Configuration\Design\Validation\TypeValidationAttribute.cs

And comment out line 60:

                // errors.Add(instance, name, SR.ExceptionTypeNotValid(typeName));

 

Re-build Enterprise library by running the batch file:

<Program Files>\Microsoft Enterprise Library\src\BuildLibrary.bat

 

posted on Thursday, February 10, 2005 12:02 AM