[Mono-list] ResourceManager class questions

Carlos Guzman Alvarez carlosga@telefonica.net
Thu, 02 Oct 2003 22:35:04 +0200


Hello:

> So, if you are getting errors like MethodNotFound exception when trying 
> to use resources, the patch may be helpful.

I have applied your patch and tested it but i'm getting an error :).

Ok, an explain of the problem, i'm creating a new instance of the 
resourcemanager class as:

MESSAGES = "FirebirdSql.Data.Firebird.Resources.Gds.isc_error_msg";

rm = new ResourceManager(MESSAGES,		 
System.Reflection.Assembly.GetExecutingAssembly());

This is is working ( or at least is not throwing an exception :) ).

The resource file is generated with ms resgen from a text file with 
contents like this:

335544321=arithmetic exception, numeric overflow, or string truncation
335544322=invalid database key
335544323=file {0} is not a valid database
335544324=invalid database handle (no active connection)
335544325=bad parameters on attach or create database
335544326=unrecognized database parameter block
335544327=invalid request handle
335544328=invalid BLOB handle

The exception gives when i try to get the value of an element of the 
resource, i'm making this as:

message = rm.GetString(code.ToString());

I have tested this too:

message = rm.GetString(code.ToString(), CultureInfo.InvariantCulture);

In both cases i get this exception ( Red hat linux 8 - Mono 0.28 )

Message:
Could not find any resource appropiate for the specified culture or its 
parents
(assembly:FirebirdSql.Data.Firebird)

StackTrace:
in <0x0032a> System.Resources.ResourceManager:InternalGetResourceSet 
(System.Globalization.CultureInfo,bool,bool)
in <0x00097> System.Resources.ResourceManager:GetString 
(string,System.Globalization.CultureInfo)
in <0x00019> System.Resources.ResourceManager:GetString (string)
in <0x0005a> FirebirdSql.Data.Firebird.Gds.GdsExceptionHelper:GetMessage 
(int)

Source:
mscorlib

This is working ok with ms .net.

For ms.net i'm making the build using nant, the resource file is build as:

<arg 
value="/resource:${resources.dir}\GDS\isc_error_msg.resources,FirebirdSql.Data.Firebird.Resources.GDS.isc_error_msg.resources"/>


For mono on linux i have a makefile, the resource file is build as:

-resource:FirebirdSql.Data.Firebird/source/Resources/GDS/isc_error_msg.resources,FirebirdSql.Data.Firebird.Resources.GDS.isc_error_msg.resources


What i'm making bad or how can make for solve this ??



Thanks in advance.






-- 
Best regards

Carlos Guzmán Álvarez
Vigo-Spain


"Todos somos muy ignorantes. Lo que ocurre es que no todos ignoramos las 
mismas cosas."

Albert Einstein.