[Mono-dev] mkbundle + System.Text.GetEncoding = NotSupportedException

Alex Shulgin alexander.shulgin at yessoftware.com
Sat Oct 31 11:27:41 EDT 2009

Hi all,

In the following scenario with mono-2.4 I get "CodePage XXX not 
supported" when trying to run mkbundle-d test program on a 'clean' box 
(w/o mono installed):

$ cat codepage.cs
using System;
using System.Text;

namespace test {
	public static class Program {
		public static void Main() {
			Console.WriteLine("Hello, world.");

			Encoding enc = Encoding.GetEncoding(1251);
			Console.WriteLine("enc: {0}", enc);

$ gmcs codepage.cs

$ mkbundle2 --deps --static codepage.exe -o codepage
OS is: Linux
Note that statically linking the LGPL Mono runtime has more licensing 
restrictions than dynamically linking.
See http://www.mono-project.com/Licensing for details on licensing.
Sources: 1 Auto-dependencies: True
    embedding: /home/alexs/tmp/mkbundle/codepage.exe
    embedding: /usr/local/lib/mono/2.0/mscorlib.dll
as -o temp.o temp.s
cc -o codepage -Wall `pkg-config --cflags mono` temp.c  `pkg-config 
--libs-only-L mono` -Wl,-Bstatic -lmono -Wl,-Bdynamic `pkg-config 
--libs-only-l mono | sed -e "s/\-lmono //"` temp.o

$ ./codepage
Hello, world.
enc: I18N.Other.CP1251

This is OK.  Now I want to emulate 'clean' box by removing all lib files 
(I have mono in /usr/local):

$ ( cd /usr/local; sudo mv lib lib~ )

$ ./codepage
Hello, world.

Unhandled Exception: System.NotSupportedException: CodePage 1251 not 
   at System.Text.Encoding.GetEncoding (Int32 codepage) [0x00000]
   at test.Program.Main () [0x00000]

So, I've identified that cp1251 lives in I18N.Other.dll.  How do I make 
mkbundle package that assembly?

I've tried adding -r:I18N or -r:I18N.Other when compiling with gmcs, but 
it mkbundle still doesn't pick it up and the end result is the same.

Help please!


More information about the Mono-devel-list mailing list