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

Commit

Permalink
Merge pull request #16080 from jkotas/netcoreapp11
Browse files Browse the repository at this point in the history
Rename netcoreapp11 ifdefs to version-less netcoreapp
  • Loading branch information
stephentoub committed Feb 12, 2017
2 parents fceca4c + 980986d commit 1836372
Show file tree
Hide file tree
Showing 18 changed files with 37 additions and 55 deletions.
1 change: 0 additions & 1 deletion src/System.IO/src/System.IO.csproj
Expand Up @@ -5,7 +5,6 @@
<AssemblyName>System.IO</AssemblyName>
<ProjectGuid>{07390899-C8F6-4e83-A3A9-6867B8CB46A0}</ProjectGuid>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
<DefineConstants Condition="'$(TargetGroup)' == 'netcoreapp' OR '$(TargetGroup)' == 'uap'">$(DefineConstants);netcoreapp17</DefineConstants>
</PropertyGroup>
<!-- Default configurations to help VS understand the options -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
Expand Down
1 change: 0 additions & 1 deletion src/System.Private.Uri/src/System.Private.Uri.csproj
Expand Up @@ -5,7 +5,6 @@
<ProjectGuid>{4AC5343E-6E31-4BA5-A795-0493AE7E9008}</ProjectGuid>
<AssemblyName>System.Private.Uri</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants Condition="'$(TargetGroup)'=='netcoreapp' OR '$(TargetGroup)'=='uap'">$(DefineConstants);netstandard10</DefineConstants>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Unix-Debug|AnyCPU'" />
Expand Down
12 changes: 2 additions & 10 deletions src/System.Private.Uri/src/System/Uri.cs
Expand Up @@ -6,20 +6,13 @@
using System.Text;
using System.Globalization;
using System.Collections.Generic;
#if netstandard10
using System.Runtime.Serialization;
#endif //netstandard10
using System.Diagnostics.CodeAnalysis;

namespace System
{
#if netstandard10
[Serializable]
#endif //netstandard10
public partial class Uri
#if netstandard10
: ISerializable
#endif
public partial class Uri : ISerializable
{
public static readonly string UriSchemeFile = UriParser.FileUri.SchemeName;
public static readonly string UriSchemeFtp = UriParser.FtpUri.SchemeName;
Expand Down Expand Up @@ -397,7 +390,7 @@ public Uri(Uri baseUri, string relativeUri)

CreateUri(baseUri, relativeUri, false);
}
#if netstandard10

//
// Uri(SerializationInfo, StreamingContext)
//
Expand Down Expand Up @@ -445,7 +438,6 @@ protected void GetObjectData(SerializationInfo serializationInfo, StreamingConte
serializationInfo.AddValue("RelativeUri", GetParts(UriComponents.SerializationInfoString, UriFormat.UriEscaped));
}
}
#endif //netstandard10

private void CreateUri(Uri baseUri, string relativeUri, bool dontEscape)
{
Expand Down
12 changes: 2 additions & 10 deletions src/System.Private.Uri/src/System/UriFormatException.cs
Expand Up @@ -2,22 +2,15 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if netstandard10
using System.Runtime.Serialization;
#endif //netstandard10

namespace System
{
/// <summary>
/// An exception class used when an invalid Uniform Resource Identifier is detected.
/// </summary>
#if netstandard10
[Serializable]
#endif //netstandard10
public class UriFormatException : FormatException
#if netstandard10
, ISerializable
#endif //netstandard10
public class UriFormatException : FormatException, ISerializable
{
public UriFormatException() : base()
{
Expand All @@ -30,14 +23,13 @@ public UriFormatException(string textString) : base(textString)
public UriFormatException(string textString, Exception e) : base(textString, e)
{
}
#if netstandard10

protected UriFormatException(SerializationInfo serializationInfo, StreamingContext streamingContext) : base(serializationInfo, streamingContext)
{
}

void ISerializable.GetObjectData(SerializationInfo serializationInfo, StreamingContext streamingContext) {
base.GetObjectData(serializationInfo, streamingContext);
}
#endif //netstandard10
}; // class UriFormatException
} // namespace System
4 changes: 2 additions & 2 deletions src/System.Security.Cryptography.Pkcs/tests/CertLoader.cs
Expand Up @@ -12,7 +12,7 @@ internal abstract partial class CertLoader
{
// Prefer ephemeral when available
protected X509KeyStorageFlags KeyStorageFlags =
#if netcoreapp11
#if netcoreapp
X509KeyStorageFlags.EphemeralKeySet;
#else
X509KeyStorageFlags.DefaultKeySet;
Expand Down Expand Up @@ -144,7 +144,7 @@ public CertLoaderFromRawData(byte[] cerData, byte[] pfxData = null, string passw

internal override CertLoader CloneAsEphemeralLoader()
{
#if netcoreapp11
#if netcoreapp
return new CertLoaderFromRawData(CerData, PfxData, Password)
{
KeyStorageFlags = X509KeyStorageFlags.EphemeralKeySet,
Expand Down
Expand Up @@ -4,7 +4,7 @@
<PropertyGroup>
<ProjectGuid>{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}</ProjectGuid>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants Condition="'$(TargetGroup)'=='netcoreapp'">$(DefineConstants);netcoreapp11</DefineConstants>
<DefineConstants Condition="'$(TargetGroup)'=='netcoreapp'">$(DefineConstants);netcoreapp</DefineConstants>
</PropertyGroup>
<!-- Don't delete these clauses even if they look useless. They tell the VS IDE that "Windows_Debug", etc., are
valid configuration for this project and stop it from trying to "fix up" the .sln file -->
Expand Down
Expand Up @@ -52,7 +52,7 @@ public static void ValidKeySizeUsesProperty()
}
}

#if netcoreapp11
#if netcoreapp
[Fact]
public static void ClearCallsDispose()
{
Expand Down
Expand Up @@ -218,7 +218,7 @@ public static void MultipleDispose()
Assert.Equal(false, output.CanRead);
}

#if netcoreapp11
#if netcoreapp
using (MemoryStream output = new MemoryStream())
{
using (CryptoStream encryptStream = new CryptoStream(output, encryptor, CryptoStreamMode.Write, leaveOpen: false))
Expand Down
Expand Up @@ -4,7 +4,7 @@
<Import Project="$(CommonTestPath)\Tests.props" />
<PropertyGroup>
<ProjectGuid>{101EB757-55A4-4F48-841C-C088640B8F57}</ProjectGuid>
<DefineConstants Condition="'$(TargetGroup)' == 'netcoreapp'">$(DefineConstants);netcoreapp11</DefineConstants>
<DefineConstants Condition="'$(TargetGroup)' == 'netcoreapp'">$(DefineConstants);netcoreapp</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Windows_NT-Release|AnyCPU'" />
Expand Down
Expand Up @@ -12,7 +12,7 @@ namespace System.Security.Cryptography.X509Certificates.Tests
internal static class Cert
{
internal const X509KeyStorageFlags EphemeralIfPossible =
#if netcoreapp11
#if netcoreapp
X509KeyStorageFlags.EphemeralKeySet;
#else
X509KeyStorageFlags.DefaultKeySet;
Expand Down
Expand Up @@ -320,7 +320,7 @@ public static void InvalidStorageFlags()
// binary is always used by default, meaning it doesn't know EphemeralKeySet doesn't exist.
}

#if netcoreapp11
#if netcoreapp
[Fact]
public static void InvalidStorageFlags_PersistedEphemeral()
{
Expand All @@ -346,7 +346,7 @@ public static IEnumerable<object[]> StorageFlags
{
yield return new object[] { X509KeyStorageFlags.DefaultKeySet };

#if netcoreapp11
#if netcoreapp
yield return new object[] { X509KeyStorageFlags.EphemeralKeySet };
#endif
}
Expand Down
Expand Up @@ -654,7 +654,7 @@ public static void ExportCert()
TestExportSingleCert(X509ContentType.Cert);
}

#if netcoreapp11
#if netcoreapp
[Fact]
public static void ExportCert_SecureString()
{
Expand Down Expand Up @@ -1401,7 +1401,7 @@ public static void X509ExtensionCollection_OidIndexer_NoMatchByFriendlyName()
}
}

#if netcoreapp11
#if netcoreapp
private static void TestExportSingleCert_SecureStringPassword(X509ContentType ct)
{
using (var pfxCer = new X509Certificate2(TestData.PfxData, TestData.CreatePfxDataPasswordSecureString(), Cert.EphemeralIfPossible))
Expand Down Expand Up @@ -1486,7 +1486,7 @@ public static IEnumerable<object[]> StorageFlags
{
yield return new object[] { X509KeyStorageFlags.DefaultKeySet };

#if netcoreapp11
#if netcoreapp
yield return new object[] { X509KeyStorageFlags.EphemeralKeySet };
#endif
}
Expand Down
Expand Up @@ -402,7 +402,7 @@ public static void InvalidStorageFlags()
// binary is always used by default, meaning it doesn't know EphemeralKeySet doesn't exist.
}

#if netcoreapp11
#if netcoreapp
[Fact]
public static void InvalidStorageFlags_PersistedEphemeral()
{
Expand Down
Expand Up @@ -39,7 +39,7 @@ public static void TestConstructor(X509KeyStorageFlags keyStorageFlags)
}
}

#if netcoreapp11
#if netcoreapp
[Theory]
[MemberData(nameof(StorageFlags))]
public static void TestConstructor_SecureString(X509KeyStorageFlags keyStorageFlags)
Expand Down Expand Up @@ -120,7 +120,7 @@ public static void TestPrivateKey(X509KeyStorageFlags keyStorageFlags)
}
}

#if netcoreapp11
#if netcoreapp
[Fact]
public static void TestPrivateKeyProperty()
{
Expand Down Expand Up @@ -180,7 +180,7 @@ public static void ReadECDsaPrivateKey_WindowsPfx(X509KeyStorageFlags keyStorage
}
}

#if netcoreapp11
#if netcoreapp
[Fact]
public static void ECDsaPrivateKeyProperty_WindowsPfx()
{
Expand Down Expand Up @@ -266,7 +266,7 @@ public static void ReadECDsaPrivateKey_OpenSslPfx(X509KeyStorageFlags keyStorage
}
}

#if netcoreapp11
#if netcoreapp
[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // Uses P/Invokes
public static void EphemeralImport_HasNoKeyName()
Expand Down Expand Up @@ -382,7 +382,7 @@ public static IEnumerable<object[]> StorageFlags
{
yield return new object[] { X509KeyStorageFlags.DefaultKeySet };

#if netcoreapp11
#if netcoreapp
yield return new object[] { X509KeyStorageFlags.EphemeralKeySet };
#endif
}
Expand Down
Expand Up @@ -4,7 +4,7 @@
<PropertyGroup>
<ProjectGuid>{A28B0064-EFB2-4B77-B97C-DECF5DAB074E}</ProjectGuid>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants Condition="'$(TargetGroup)'=='netcoreapp'">$(DefineConstants);netcoreapp11</DefineConstants>
<DefineConstants Condition="'$(TargetGroup)'=='netcoreapp'">$(DefineConstants);netcoreapp</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Unix-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Unix-Release|AnyCPU'" />
Expand Down
2 changes: 1 addition & 1 deletion src/System.ValueTuple/tests/System.ValueTuple.Tests.csproj
Expand Up @@ -3,7 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<ProjectGuid>{CBD5AE8D-8595-48E2-848F-1A3492A28FDB}</ProjectGuid>
<DefineConstants Condition="'$(TargetGroup)'=='netcoreapp'">$(DefineConstants);netcoreapp11</DefineConstants>
<DefineConstants Condition="'$(TargetGroup)'=='netcoreapp'">$(DefineConstants);netcoreapp</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<LangVersion>5</LangVersion>
Expand Down
2 changes: 1 addition & 1 deletion src/System.ValueTuple/tests/TupleTests.cs
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if netcoreapp11
#if netcoreapp
using System;
using System.Collections;
using System.Collections.Generic;
Expand Down
24 changes: 12 additions & 12 deletions src/System.ValueTuple/tests/ValueTupleTests.cs
Expand Up @@ -6,7 +6,7 @@
using System.Collections;
using System.Collections.Generic;
using Xunit;
#if netcoreapp11
#if netcoreapp
using System.Runtime.CompilerServices;
using System.Runtime.Serialization.Formatters.Tests;
#endif
Expand Down Expand Up @@ -778,7 +778,7 @@ public static void ZeroTuples()
Assert.Throws<ArgumentException>(() => ((IStructuralComparable)a).CompareTo("string", DummyTestComparer.Instance));

Assert.Equal("(1, 2, 3, 4, 5, 6, 7, )", CreateLong(1, 2, 3, 4, 5, 6, 7, new ValueTuple()).ToString());
#if netcoreapp11
#if netcoreapp
ITuple it = ValueTuple.Create();
Assert.Throws<IndexOutOfRangeException>(() => it[-1].ToString());
Assert.Throws<IndexOutOfRangeException>(() => it[0].ToString());
Expand Down Expand Up @@ -809,7 +809,7 @@ public static void OneTuples()
Assert.Equal("()", vtWithNull.ToString());
Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());

#if netcoreapp11
#if netcoreapp
ITuple it = ValueTuple.Create(1);
Assert.Throws<IndexOutOfRangeException>(() => it[-1].ToString());
Assert.Equal(1, it[0]);
Expand Down Expand Up @@ -841,7 +841,7 @@ public static void TwoTuples()
Assert.Equal("(, )", vtWithNull.ToString());
Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());

#if netcoreapp11
#if netcoreapp
ITuple it = ValueTuple.Create(1, 2);
Assert.Throws<IndexOutOfRangeException>(() => it[-1].ToString());
Assert.Equal(1, it[0]);
Expand Down Expand Up @@ -876,7 +876,7 @@ public static void ThreeTuples()
Assert.Equal("(, , )", vtWithNull.ToString());
Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());

#if netcoreapp11
#if netcoreapp
ITuple it = ValueTuple.Create(1, 2, 3);
Assert.Throws<IndexOutOfRangeException>(() => it[-1].ToString());
Assert.Equal(1, it[0]);
Expand Down Expand Up @@ -915,7 +915,7 @@ public static void FourTuples()
Assert.Equal("(, , , )", vtWithNull.ToString());
Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());

#if netcoreapp11
#if netcoreapp
ITuple it = ValueTuple.Create(1, 2, 3, 4);
Assert.Throws<IndexOutOfRangeException>(() => it[-1].ToString());
Assert.Equal(1, it[0]);
Expand Down Expand Up @@ -957,7 +957,7 @@ public static void FiveTuples()
Assert.Equal("(, , , , )", vtWithNull.ToString());
Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());

#if netcoreapp11
#if netcoreapp
ITuple it = ValueTuple.Create(1, 2, 3, 4, 5);
Assert.Throws<IndexOutOfRangeException>(() => it[-1].ToString());
Assert.Equal(1, it[0]);
Expand Down Expand Up @@ -1002,7 +1002,7 @@ public static void SixTuples()
Assert.Equal("(, , , , , )", vtWithNull.ToString());
Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());

#if netcoreapp11
#if netcoreapp
ITuple it = ValueTuple.Create(1, 2, 3, 4, 5, 6);
Assert.Throws<IndexOutOfRangeException>(() => it[-1].ToString());
Assert.Equal(1, it[0]);
Expand Down Expand Up @@ -1050,7 +1050,7 @@ public static void SevenTuples()
Assert.Equal("(, , , , , , )", vtWithNull.ToString());
Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());

#if netcoreapp11
#if netcoreapp
ITuple it = ValueTuple.Create(1, 2, 3, 4, 5, 6, 7);
Assert.Throws<IndexOutOfRangeException>(() => it[-1].ToString());
Assert.Equal(1, it[0]);
Expand Down Expand Up @@ -1122,7 +1122,7 @@ public static void EightTuples()
Assert.Equal("(, , , , , , , )", vtWithNull.ToString());
Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());

#if netcoreapp11
#if netcoreapp
ITuple it = CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8));
Assert.Throws<IndexOutOfRangeException>(() => it[-1].ToString());
Assert.Equal(1, it[0]);
Expand Down Expand Up @@ -1211,7 +1211,7 @@ public static void EightTuplesWithBadRest()

Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 1, 0, 0, 0, 0, 0, 0, 42)", CreateLong(1, 2, 3, 4, 5, 6, 7, d).ToString());

#if netcoreapp11
#if netcoreapp
ITuple it = d;
Assert.Throws<IndexOutOfRangeException>(() => it[-1].ToString());
Assert.Equal(1, it[0]);
Expand All @@ -1226,7 +1226,7 @@ public static void EightTuplesWithBadRest()
#endif
}

#if netcoreapp11
#if netcoreapp
[Fact]
public static void ValueTupleSerialization()
{
Expand Down

0 comments on commit 1836372

Please sign in to comment.