[Mono-list] ResourceManager calling a nonexistent contructor in my type!!

Francisco Figueiredo Jr. fxjrlists@yahoo.com.br
Thu, 04 Sep 2003 18:56:10 -0300


Hi all,

I found a strange behaviour of ResourceManager and would like to ask you 
if it would be a problem or is my mistake.


It is always throwing me an ConstructorNotFound exception.
I could check in the code that the problem is the following line(290):

set=(ResourceSet)Activator.CreateInstance(resourceSetType, args);

The problem is that resourceSetType is being set to be of the type of 
the class I'm trying to use the resource.

the resourceSetType is set in the constructor:
public ResourceManager (Type resourceSource)

in the line:
resourceSetType = resourceSource;

But this constructor is what I call when I want to create a 
ResourceManager for my type:

resman = new ResourceManager(typeof(MyType));

So the call to get the constructor which receives a Stream as a 
parameter is incorrectly changed from ResourceSet type to mine.

I could make it work by changing the line which gives me the exception 
with the following line:
set=(ResourceSet)Activator.CreateInstance(typeof(ResourceSet), args);

where typeof(ResourceSet) seems to be the default value of resourceSetType.

So the question is: is it possible to pass another type to 
ResourceManager where it would get the resources from? Or can we just 
use the typeof(ResourceSet)??

I can see in the code that there is a lot of checking of the type of 
resourceSetType to be at least derived from ResourceSet, but this 
constructor doesn't do this check and if it does, my code starts to fail 
as I don't pass a type which inherits from ResourceSet.


Thanks for attention and sorry if it is confusing. Please let me know if 
you need more information.


-- 
Regards,

Francisco Figueiredo Jr.

------
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi