Config tool error: Assembly does not contain any objects that inherit from System.Object.

Topics: Validation Application Block
Mar 1, 2007 at 9:07 PM
Edited Mar 1, 2007 at 9:16 PM
In the Validation configuration tool, when I try to load an assembly that contains classes that all inherit from classes in another assembly; I get an error message stating "There were no types found that implement or inherit from the base type 'System.Object'". Thus, I am not able to add validation to my objects.

Note the Assembly I am trying to load is auto-generated from a code generator so there is not a lot of room for changing that assembly to accommodate this issue.
Mar 1, 2007 at 10:48 PM
Does it work if you load the dependent assembly into the picker first?
Mar 1, 2007 at 11:13 PM
Unfortunately, no it does not.

After some more digging it seems that the issue has nothing to do with error message I am getting. When I create a completely separate Assembly, and reference it instead of trying to reference the version in the debug directory (that is copied in from a project referance), the Type chooser allows me to load it.

I suspect this is the same problem that generates the message below when trying to specify a Validator that is in the same Assembly as you are trying to configure.

---------------------------
No Types Found In Assembly.
---------------------------
There were no types found in the assembly 'ClassLibrary1' that implement or inherit from the base type 'Microsoft.Practices.EnterpriseLibrary.Validation.Validator'.
---------------------------
OK
---------------------------


Thanks again.

Mar 2, 2007 at 2:28 AM
Steve,

I asssume you were trying to load your Custom Validator?

I believe it is looking for an attribute on the custom validator as shown below and the error you are getting is a bit misleading.

[ConfigurationElementType(typeof(CustomValidatorData))]

Load the app.config I provided in your other discussion and you will see the Load Assembly... Option finds the custom validator:

Validation not being run.

Regards,

Dave

__________________

David Hayden
Microsoft MVP C#