Repository: reef Updated Branches: refs/heads/master c26901fc4 -> 44bb76eb7
[REEF-1530] Fix CoreCLR incompatibilities in Tang related to String.StartsWith method This addresses the issue by: * Replacing the String.StartsWith method, which is incompatible with CoreCLR, with CompareInfo.IsPrefix JIRA: [REEF-1530](https://issues.apache.org/jira/browse/REEF-1530) Pull request: This closes #1098 Project: http://git-wip-us.apache.org/repos/asf/reef/repo Commit: http://git-wip-us.apache.org/repos/asf/reef/commit/44bb76eb Tree: http://git-wip-us.apache.org/repos/asf/reef/tree/44bb76eb Diff: http://git-wip-us.apache.org/repos/asf/reef/diff/44bb76eb Branch: refs/heads/master Commit: 44bb76eb7b5d9782f7da0893c758a9dd09126d83 Parents: c26901f Author: Shiv Sundram <[email protected]> Authored: Tue Aug 16 14:55:00 2016 -0700 Committer: Mariia Mykhailova <[email protected]> Committed: Tue Aug 16 16:03:45 2016 -0700 ---------------------------------------------------------------------- lang/cs/Org.Apache.REEF.Tang/Util/ReflectionUtilities.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/reef/blob/44bb76eb/lang/cs/Org.Apache.REEF.Tang/Util/ReflectionUtilities.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Util/ReflectionUtilities.cs b/lang/cs/Org.Apache.REEF.Tang/Util/ReflectionUtilities.cs index 813e53c..9788afa 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Util/ReflectionUtilities.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Util/ReflectionUtilities.cs @@ -513,9 +513,10 @@ namespace Org.Apache.REEF.Tang.Util if (type != null) { // HACK: The only way to detect anonymous types right now. + CompareInfo myComp = CultureInfo.CurrentCulture.CompareInfo; return CustomAttributeExtensions.IsDefined(type, typeof(CompilerGeneratedAttribute), false) && type.IsGenericType && type.Name.Contains("AnonymousType") - && (type.Name.StartsWith("<>", true, CultureInfo.CurrentCulture) || type.Name.StartsWith("VB$", true, CultureInfo.CurrentCulture)) + && (myComp.IsPrefix(type.Name, "<>", CompareOptions.IgnoreCase) || myComp.IsPrefix(type.Name, "VB$", CompareOptions.IgnoreCase)) && (type.Attributes & TypeAttributes.NotPublic) == TypeAttributes.NotPublic; } return false;
