Skip to content

Commit

Permalink
Workaround for cross-gen bug https://github.com/dotnet/coreclr/issues…
Browse files Browse the repository at this point in the history
  • Loading branch information
tmat committed May 5, 2016
1 parent f6554c8 commit 5c5feb3
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/Compilers/Core/Portable/InternalUtilities/MultiDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,21 @@ public int Count
{
return 0;
}
else

// The following code used to be written like so:
//
// return (_value as ImmutableHashSet<V>)?.Count ?? 1;
//
// This code pattern triggered a code-gen bug on Mac:
// https://github.com/dotnet/coreclr/issues/4801

var set = _value as ImmutableHashSet<V>;
if (set == null)
{
return (_value as ImmutableHashSet<V>)?.Count ?? 1;
return 1;
}

return set.Count;
}
}

Expand Down

0 comments on commit 5c5feb3

Please sign in to comment.