Bug 31398

Summary: Cultures zh-Hans and zh-CHS are equal when they should not be
Product: [Mono] Class Libraries Reporter: Adam Hartley [MSFT] <adam.hartley>
Component: mscorlibAssignee: Marek Safar <masafa>
Status: RESOLVED FIXED    
Severity: normal CC: brendan.zagaeski, chris.hamons, chrisntr, masafa, mono-bugs+monomac, mono-bugs+mono, smitty825
Priority: ---    
Version: unspecified   
Target Milestone: Untriaged   
Hardware: PC   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:
Attachments: Sample code

Description Adam Hartley [MSFT] 2015-06-26 06:20:47 UTC
Created attachment 11748 [details]
Sample code

## Overview

In Xamarin.Mac, zh-Hans and zh-CHS are treated as equal, whereas in .NET on Windows this is not the case.

## Steps to reproduce

1. Download attached .cs file which provides example code.
2. Compile and run.

## Expected result

No exception.

## Actual result

"An item with the same key has already been added" exception due to zh-Hans and zh-CHS being equal when they should not be.

## Notes

If you run the resulting exe on Windows it works without throwing an exception.
Comment 2 Chris Hamons 2015-06-26 09:51:32 UTC
Xamarin.Mac is the Mac bindings for writing GUI applications. In the example above, there is no GUI needed to reproduce the issue. I'm moving to the ClassLib section.
Comment 3 Marek Safar 2015-06-26 10:31:24 UTC
Fixed in master and Mono 4.2
Comment 4 Dan Smith 2015-06-26 20:22:52 UTC
Thanks for attempting to fix this Marek!

The fix (c67cb40) you provided still doesn't quite match the documentation & the MS implementation.  

Mono Docs: http://developer.xamarin.com/api/member/System.Globalization.CultureInfo.Equals(System.Object)/

"Two CultureInfo objects are considered equal if their CultureInfo.Name and CultureInfo.CompareInfo properties are equal."

The implementation you provided checks the CultureInfo.Name, but not the CultureInfo.CompareInfo property.  (It still checks the LCID)