Avoid failures when allocate memory in native (#8028)
authorTarek Mahmoud Sayed <tarekms@microsoft.com>
Wed, 9 Nov 2016 04:38:41 +0000 (20:38 -0800)
committerGitHub <noreply@github.com>
Wed, 9 Nov 2016 04:38:41 +0000 (20:38 -0800)
commit72757f84b32951f873c5d4ca6ae8bc947e8356b3
tree8b865e6213f61dfce651ed2dcb027e5778734f6e
parentc106ebd2cfb76262250c9f038897c6e7154eb433
Avoid failures when allocate memory in native (#8028)

* Avoid failures when allocate memory in native

using new in the native side can throw and the app will shutdown. instead we detect the failure and throw a managed exception

* Use same mechanism we return the error code from GetSortHandle

* Add assert

* Dispose the safeHandle
src/corefx/System.Globalization.Native/collation.cpp
src/corefx/System.Globalization.Native/errors.h
src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Collation.cs
src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.ResultCode.cs
src/mscorlib/corefx/SR.cs
src/mscorlib/corefx/System/Globalization/CompareInfo.Unix.cs