Bug 29294 - ReferenceSource System.Text.Encoding GetEncoding sometimes returns null instead of throwing NotSupportedException
Summary: ReferenceSource System.Text.Encoding GetEncoding sometimes returns null inste...
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
URL:
: 31010 ()
Depends on:
Blocks:
 
Reported: 2015-04-22 03:25 UTC by Timotheus Pokorra
Modified: 2015-09-02 10:53 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
test for GetEncoding returning null (806 bytes, text/x-csharp)
2015-04-22 03:27 UTC, Timotheus Pokorra
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Timotheus Pokorra 2015-04-22 03:25:48 UTC
Testing with Mono 4 Alpha1, I have a problem with MonoDevelop TextEditor which uses GetEncoding and relies on exception NotSupportedException to be thrown:
https://github.com/mono/monodevelop/blob/master/main/src/core/Mono.Texteditor/Mono.TextEditor.Utils/TextFileUtility.cs#L42

see for details: https://github.com/tpokorra/lbs-mono-fedora/issues/14

I assume that the System.Text.Encoding for Mono4 Alpha1 already comes from the Reference Sources, and somehow this sometimes returns null on Linux.
Comment 1 Timotheus Pokorra 2015-04-22 03:27:51 UTC
Created attachment 10856 [details]
test for GetEncoding returning null

output of test program:

EncodingInfo name: IBM037
    is null
EncodingInfo name: IBM437
EncodingInfo name: IBM500
    is null
EncodingInfo name: ASMO-708
    is null
EncodingInfo name: ibm850
EncodingInfo name: ibm852
    is null
EncodingInfo name: IBM855
    is null
EncodingInfo name: ibm857
    is null
EncodingInfo name: IBM00858
    is null
EncodingInfo name: IBM860
EncodingInfo name: ibm861
EncodingInfo name: DOS-862
    is null
EncodingInfo name: IBM863
EncodingInfo name: IBM864
    is null
EncodingInfo name: IBM865
EncodingInfo name: cp866
    is null
EncodingInfo name: ibm869
    is null
EncodingInfo name: IBM870
    is null
EncodingInfo name: windows-874
    is null
EncodingInfo name: cp875
    is null
EncodingInfo name: shift_jis
    is null
EncodingInfo name: gb2312
    is null
EncodingInfo name: ks_c_5601-1987
    is null
EncodingInfo name: big5
    is null
EncodingInfo name: IBM1026
    is null
EncodingInfo name: IBM01047
    is null
EncodingInfo name: IBM01140
    is null
EncodingInfo name: IBM01141
    is null
EncodingInfo name: IBM01142
    is null
EncodingInfo name: IBM01143
    is null
EncodingInfo name: IBM01144
    is null
EncodingInfo name: IBM01145
    is null
EncodingInfo name: IBM01146
    is null
EncodingInfo name: IBM01147
    is null
EncodingInfo name: IBM01148
    is null
EncodingInfo name: IBM01149
    is null
EncodingInfo name: utf-16
EncodingInfo name: utf-16BE
EncodingInfo name: windows-1250
EncodingInfo name: windows-1251
    is null
EncodingInfo name: Windows-1252
EncodingInfo name: windows-1253
EncodingInfo name: windows-1254
    is null
EncodingInfo name: windows-1255
    is null
EncodingInfo name: windows-1256
    is null
EncodingInfo name: windows-1257
    is null
EncodingInfo name: windows-1258
    is null
EncodingInfo name: macintosh
EncodingInfo name: x-mac-icelandic
EncodingInfo name: utf-32
EncodingInfo name: utf-32BE
EncodingInfo name: us-ascii
EncodingInfo name: IBM273
    is null
EncodingInfo name: IBM277
    is null
EncodingInfo name: IBM278
    is null
EncodingInfo name: IBM280
    is null
EncodingInfo name: IBM284
    is null
EncodingInfo name: IBM285
    is null
EncodingInfo name: IBM290
    is null
EncodingInfo name: IBM297
    is null
EncodingInfo name: IBM420
    is null
EncodingInfo name: IBM424
    is null
EncodingInfo name: koi8-r
    is null
EncodingInfo name: IBM871
    is null
EncodingInfo name: cp1025
    is null
EncodingInfo name: koi8-u
    is null
EncodingInfo name: iso-8859-1
EncodingInfo name: iso-8859-2
EncodingInfo name: iso-8859-3
EncodingInfo name: iso-8859-4
    is null
EncodingInfo name: iso-8859-5
    is null
EncodingInfo name: iso-8859-6
    is null
EncodingInfo name: iso-8859-7
EncodingInfo name: iso-8859-8
    is null
EncodingInfo name: iso-8859-9
    is null
EncodingInfo name: iso-8859-15
EncodingInfo name: iso-8859-8-i
    is null
EncodingInfo name: iso-2022-jp
    is null
EncodingInfo name: csISO2022JP
    is null
EncodingInfo name: iso-2022-jp
    is null
EncodingInfo name: euc-jp
    is null
EncodingInfo name: euc-kr
    is null
EncodingInfo name: GB18030
    is null
EncodingInfo name: x-iscii-de
    is null
EncodingInfo name: x-iscii-be
    is null
EncodingInfo name: x-iscii-ta
    is null
EncodingInfo name: x-iscii-te
    is null
EncodingInfo name: x-iscii-as
    is null
EncodingInfo name: x-iscii-or
    is null
EncodingInfo name: x-iscii-ka
    is null
EncodingInfo name: x-iscii-ma
    is null
EncodingInfo name: x-iscii-gu
    is null
EncodingInfo name: x-iscii-pa
    is null
EncodingInfo name: utf-7
EncodingInfo name: utf-8
Comment 2 Marek Safar 2015-04-27 13:03:56 UTC
I cannot reproduce it locally with master, my linux mint returns following (perhaps you are missing some encoding assemblies) 

EncodingInfo name: IBM037
EncodingInfo name: IBM437
EncodingInfo name: IBM500
EncodingInfo name: ASMO-708
EncodingInfo name: ibm850
EncodingInfo name: ibm852
EncodingInfo name: IBM855
EncodingInfo name: ibm857
EncodingInfo name: IBM00858
EncodingInfo name: IBM860
EncodingInfo name: ibm861
EncodingInfo name: DOS-862
EncodingInfo name: IBM863
EncodingInfo name: IBM864
EncodingInfo name: IBM865
EncodingInfo name: cp866
EncodingInfo name: ibm869
EncodingInfo name: IBM870
EncodingInfo name: windows-874
EncodingInfo name: cp875
EncodingInfo name: shift_jis
EncodingInfo name: gb2312
EncodingInfo name: ks_c_5601-1987
EncodingInfo name: big5
EncodingInfo name: IBM1026
EncodingInfo name: IBM01047
EncodingInfo name: IBM01140
EncodingInfo name: IBM01141
EncodingInfo name: IBM01142
EncodingInfo name: IBM01143
EncodingInfo name: IBM01144
EncodingInfo name: IBM01145
EncodingInfo name: IBM01146
EncodingInfo name: IBM01147
EncodingInfo name: IBM01148
EncodingInfo name: IBM01149
EncodingInfo name: utf-16
EncodingInfo name: utf-16BE
EncodingInfo name: windows-1250
EncodingInfo name: windows-1251
EncodingInfo name: Windows-1252
EncodingInfo name: windows-1253
EncodingInfo name: windows-1254
EncodingInfo name: windows-1255
EncodingInfo name: windows-1256
EncodingInfo name: windows-1257
EncodingInfo name: windows-1258
EncodingInfo name: macintosh
EncodingInfo name: x-mac-icelandic
EncodingInfo name: utf-32
EncodingInfo name: utf-32BE
EncodingInfo name: us-ascii
EncodingInfo name: IBM273
EncodingInfo name: IBM277
EncodingInfo name: IBM278
EncodingInfo name: IBM280
EncodingInfo name: IBM284
EncodingInfo name: IBM285
EncodingInfo name: IBM290
EncodingInfo name: IBM297
EncodingInfo name: IBM420
EncodingInfo name: IBM424
EncodingInfo name: koi8-r
EncodingInfo name: IBM871
EncodingInfo name: cp1025
EncodingInfo name: koi8-u
EncodingInfo name: iso-8859-1
EncodingInfo name: iso-8859-2
EncodingInfo name: iso-8859-3
EncodingInfo name: iso-8859-4
EncodingInfo name: iso-8859-5
EncodingInfo name: iso-8859-6
EncodingInfo name: iso-8859-7
EncodingInfo name: iso-8859-8
EncodingInfo name: iso-8859-9
EncodingInfo name: iso-8859-15
EncodingInfo name: iso-8859-8-i
EncodingInfo name: iso-2022-jp
EncodingInfo name: csISO2022JP
EncodingInfo name: iso-2022-jp
EncodingInfo name: euc-jp
EncodingInfo name: euc-kr
EncodingInfo name: GB18030
EncodingInfo name: x-iscii-de
EncodingInfo name: x-iscii-be
EncodingInfo name: x-iscii-ta
EncodingInfo name: x-iscii-te
EncodingInfo name: x-iscii-as
EncodingInfo name: x-iscii-or
EncodingInfo name: x-iscii-ka
EncodingInfo name: x-iscii-ma
EncodingInfo name: x-iscii-gu
EncodingInfo name: x-iscii-pa
EncodingInfo name: utf-7
EncodingInfo name: utf-8
Comment 3 Timotheus Pokorra 2015-04-28 15:24:24 UTC
Thanks for your suggestion, now I found the solution:

yum install mono-locale-extras
Comment 4 Timotheus Pokorra 2015-07-13 00:31:22 UTC
I found two bugs that are probably duplicates of this bug: bug 30708 and bug 31010.

I wonder if this bug should be reopened, and properly fixed.

You can reproduce the bug by uninstalling mono-locale-extras
Comment 5 Marek Safar 2015-08-03 04:02:57 UTC
This was already fixed few months ago

https://github.com/mono/referencesource/commit/49534f8e7ac0682c4e06f1948bdc6f068483c04d
Comment 6 Lluis Sanchez 2015-09-02 10:53:45 UTC
*** Bug 31010 has been marked as a duplicate of this bug. ***