Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Remove the BinaryCompatibility class as it is not useful on .NET Core… #8396

Merged
merged 3 commits into from
Dec 1, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/mscorlib/mscorlib.shared.sources.props
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,6 @@
<SerializationSources Include="$(BclSourcesRoot)\System\Runtime\Serialization\SafeSerializationManager.cs" />
</ItemGroup>
<ItemGroup>
<VersioningSources Include="$(BclSourcesRoot)\System\Runtime\Versioning\BinaryCompatibility.cs" />
<VersioningSources Include="$(BclSourcesRoot)\System\Runtime\Versioning\TargetFrameworkAttribute.cs" />
<VersioningSources Include="$(BclSourcesRoot)\System\Runtime\Versioning\TargetFrameworkId.cs" />
<VersioningSources Include="$(BclSourcesRoot)\System\Runtime\Versioning\CompatibilitySwitch.cs" />
Expand Down
11 changes: 1 addition & 10 deletions src/mscorlib/src/System/Collections/Generic/ArraySortHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,7 @@ internal static int FloorLog2(int n)
}

internal static void ThrowOrIgnoreBadComparer(Object comparer) {
// This is hit when an invarant of QuickSort is violated due to a bad IComparer implementation (for
// example, imagine an IComparer that returns 0 when items are equal but -1 all other times).
//
// We could have thrown this exception on v4, but due to changes in v4.5 around how we partition arrays
// there are different sets of input where we would throw this exception. In order to reduce overall risk from
// an app compat persective, we're changing to never throw on v4. Instead, we'll return with a partially
// sorted array.
if(BinaryCompatibility.TargetsAtLeast_Desktop_V4_5) {
throw new ArgumentException(Environment.GetResourceString("Arg_BogusIComparer", comparer));
}
throw new ArgumentException(Environment.GetResourceString("Arg_BogusIComparer", comparer));
}

}
Expand Down
4 changes: 2 additions & 2 deletions src/mscorlib/src/System/Collections/Generic/List.cs
Original file line number Diff line number Diff line change
Expand Up @@ -545,13 +545,13 @@ public void ForEach(Action<T> action) {
int version = _version;

for(int i = 0 ; i < _size; i++) {
if (version != _version && BinaryCompatibility.TargetsAtLeast_Desktop_V4_5) {
if (version != _version) {
break;
}
action(_items[i]);
}

if (version != _version && BinaryCompatibility.TargetsAtLeast_Desktop_V4_5)
if (version != _version)
ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2881,7 +2881,7 @@ void InsertHash(TokenHashValue[] hashTable, String str, TokenType tokenType, int
// - if the app is targetting 4.5.1 or above OR the compat flag is set, use the correct behavior by default.
// - if the app is targetting 4.5 or below AND the compat switch is set, use the correct behavior
// - if the app is targetting 4.5 or below AND the compat switch is NOT set, use the incorrect behavior
if (preferExistingTokens || BinaryCompatibility.TargetsAtLeast_Desktop_V4_5_1)
if (preferExistingTokens)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be the other way around? preferExistingTokens is always false on coreclr so you'd use the incorrect behavior in the else as per the comment above.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right! We actually need to remove the other branch of the if and only keep the code (without the if) here.

{
if (((nCurrentTokenTypeInHash & (int)TokenType.RegularTokenMask) == 0) && ((nTokenType & (int)TokenType.RegularTokenMask) != 0) ||
((nCurrentTokenTypeInHash & (int)TokenType.SeparatorTokenMask) == 0) && ((nTokenType & (int)TokenType.SeparatorTokenMask) != 0))
Expand Down
Loading