[Mono-devel-list] [PATCH] ResourceManager is calling an incorrect constructor
Francisco Figueiredo Jr.
fxjrlists at yahoo.com.br
Wed Oct 1 14:01:44 EDT 2003
Hi all.
I found this small bug in ResourceManager.
It tries in the line 290:
set=(ResourceSet)Activator.CreateInstance(resourceSetType, args);
to call a constructor in the type resourceSetType which only exists in
the ResourceSet type and possible subtypes.
If I use this constructor as
resman = new ResourceManager(typeof(MyType));
it will try to call the constructor in MyType which for sure will not
know anything about loading resources.
This is caused by an misinitialization of the resourceSetType in the
ResourceManager constructor which takes a Type as a parameter.
In the docs, it is said this Type is used by ResourceManager to get info
about assembly and other things, but not to use this type as the source
of resources.
So I think this field initialization should be the same as the default
constructor, typeof(ResourceSet).
I'm using this modification in my projects and they are working very well.
I will create a test case and add it to the test cases.
Thanks for attention.
[fxjr at IGARAPAVA System.Resources]$ cvs -z3 diff -u
cvs server: Diffing .
Index: ResourceManager.cs
===================================================================
RCS file: /mono/mcs/class/corlib/System.Resources/ResourceManager.cs,v
retrieving revision 1.19
diff -u -r1.19 ResourceManager.cs
--- ResourceManager.cs 6 May 2003 19:12:13 -0000 1.19
+++ ResourceManager.cs 1 Oct 2003 17:54:22 -0000
@@ -49,7 +49,7 @@
BaseNameField = resourceSource.FullName;
MainAssembly = resourceSource.Assembly;
- resourceSetType = resourceSource;
+ resourceSetType= typeof(ResourceSet);
neutral_culture =
GetNeutralResourcesLanguage(MainAssembly);
}
More information about the Mono-devel-list
mailing list