Mono 1.2.6 Runtime has a bug in System.Text.Encoding Assembly

Bug #235858 reported by akiladila
2
Affects Status Importance Assigned to Milestone
mono (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: mono-runtime

Release: Ubuntu 8.04 Hardy Heron
Package: mono-runtime installed version: 1.2.6+dfsg-6ununtu3

My Code:

using System;
using System.Text;
using System.Globalization;
using System.IO;

public class SamplesEncoding {

  public static void Main() {
    Encoding _encoding = null;
    Console.WriteLine("The OEM Code Page Identifier is {0}",
              CultureInfo.CurrentCulture.TextInfo.OEMCodePage);
    try{
    _encoding = Encoding.GetEncoding(CultureInfo.CurrentCulture.TextInfo.OEMCodePage);
    }catch(NotSupportedException e){
      Console.WriteLine("You are toast got exception");
      Console.WriteLine(e.ToString());
      Environment.Exit(1);
    }
    Console.WriteLine("Exiting Normally, Goodbye");
  }
}

Code Built via command:
gmcs /out:encoding_test.exe /t:exe encoding.cs

Command used to execute code:
mono encoding_test.exe

Results:
aha@stanwyk:~/scratch/zip_test$ mono encode_test.exe
The OEM Code Page Identifier is 437
You are toast got exception
System.NotSupportedException: CodePage 437 not supported
  at System.Text.Encoding.GetEncoding (Int32 codePage) [0x00000]
  at SamplesEncoding.Main () [0x00000]

Expected results:
aha@stanwyk:~/scratch/zip_test$ ~/tools/mono-1.2.6/bin/mono encode_test.exe
The OEM Code Page Identifier is 437
Exiting Normally, Goodbye

Methodology used to identify bug:
1. I compiled Mono 1.2.6 from the source at Novell using:
    ./configure --prefix=/home/aha/tools/mono-1.2.6
    make
    make install
2. I then compiled the source listed above using the mono distributed with Hardy Heron
3. I attempted to run the Assembly encoding_test.exe using the mono runtime distributed with Hardy Heron
    and received an exception
4. I ran the same code using the mono runtime that I compiled from scratch and the code ran as expected.

Revision history for this message
Jo Shields (directhex) wrote :

This is fixed in 1.9.1, which is part of Ubuntu Intrepid (8.10):

directhex@mortos:/tmp$ gmcs encodeytest.cs
encodeytest.cs(9,14): warning CS0219: The variable `_encoding' is assigned but its value is never used
Compilation succeeded - 1 warning(s)
directhex@mortos:/tmp$ mono encodeytest.exe
The OEM Code Page Identifier is 850
Exiting Normally, Goodbye

Changed in mono:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.