Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added explicit .NET 6 TFMs. #28911

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
4 changes: 2 additions & 2 deletions eng/Directory.Build.Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@
<SupportsNetStandard20 Condition="'$(SupportsNetStandard20)' == '' and '$(IsClientLibrary)' == 'true'">true</SupportsNetStandard20>
<SupportsNetStandard20 Condition="'$(SupportsNetStandard20)' == ''">false</SupportsNetStandard20>

<RequiredTargetFrameworks>net452;netstandard1.4;net461;netstandard2.0</RequiredTargetFrameworks>
<RequiredTargetFrameworks Condition="'$(SupportsNetStandard20)' == 'true'">netstandard2.0</RequiredTargetFrameworks>
<RequiredTargetFrameworks>net452;netstandard1.4;net461;netstandard2.0;net6.0</RequiredTargetFrameworks>
AraHaan marked this conversation as resolved.
Show resolved Hide resolved
<RequiredTargetFrameworks Condition="'$(SupportsNetStandard20)' == 'true'">netstandard2.0;net6.0</RequiredTargetFrameworks>
</PropertyGroup>

<PropertyGroup Condition="'$(IsTestProject)' == 'true' or '$(IsTestSupportProject)' == 'true' or '$(IsSamplesProject)' == 'true' or '$(IsPerfProject)' == 'true' or '$(IsStressProject)' == 'true'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<ItemGroup>
<PackageReference Include="Azure.Core" />
<PackageReference Include="Azure.Core.Experimental" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="System.Text.Json" Condition="'$(TargetFramework)' != 'net6.0'" />
</ItemGroup>

<!-- Shared source from Azure.Core -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="Azure.Core" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="System.Text.Json" Condition="'$(TargetFramework)' != 'net6.0'" />
</ItemGroup>

<!-- Shared source from Azure.Core -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

<ItemGroup>
<PackageReference Include="Azure.Core" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Condition="'$(TargetFramework)' != 'net6.0'" />
<PackageReference Include="System.Text.Json" Condition="'$(TargetFramework)' != 'net6.0'" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<ItemGroup>
<PackageReference Include="Azure.Core" />
<PackageReference Include="System.Memory.Data" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="System.Text.Json" Condition="'$(TargetFramework)' != 'net6.0'" />
</ItemGroup>

<!-- Shared source from Azure.Core -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Moq" />
<PackageReference Include="System.Security.Cryptography.Cng" />
<PackageReference Include="System.Security.Cryptography.Cng" Condition="'$(TargetFramework)' != 'net6.0'" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Text.Encodings.Web" />
<PackageReference Include="System.Text.Encodings.Web" Condition="'$(TargetFramework)' != 'net6.0'" />
<PackageReference Include="Microsoft.Azure.Batch" />
<PackageReference Include="WindowsAzure.Storage" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Text.Encodings.Web" />
<PackageReference Include="System.Text.Encodings.Web" Condition="'$(TargetFramework)' != 'net6.0'" />
<PackageReference Include="WindowsAzure.Storage" />
<PackageReference Include="Microsoft.Azure.Batch" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Text.Encodings.Web" />
<PackageReference Include="System.Text.Encodings.Web" Condition="'$(TargetFramework)' != 'net6.0'" />
</ItemGroup>

<ItemGroup Condition="'$(IsTargetingNetFx)' == 'true'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageReference Include="Azure.Storage.Blobs" />
<PackageReference Include="Microsoft.Rest.ClientRuntime" />
<PackageReference Include="Portable.BouncyCastle" />
<PackageReference Include="System.IO.Compression" />
<PackageReference Include="System.IO.Compression" Condition="'$(TargetFramework)' != 'net6.0'" />
<PackageReference Include="Microsoft.Azure.Management.Batch" />
<PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" VersionOverride="[3.14.2, 4.0.0)" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<ItemGroup>
<PackageReference Include="Azure.Core" />
<PackageReference Include="Azure.Core.Experimental" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="System.Text.Json" Condition="'$(TargetFramework)' != 'net6.0'" />
</ItemGroup>

<!-- Shared source from Azure.Core -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<ItemGroup>
<PackageReference Include="Azure.Core" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="System.Text.Json" Condition="'$(TargetFramework)' != 'net6.0'" />
</ItemGroup>

<!-- Shared source from Azure.Core -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Net.Http" />
<PackageReference Include="System.Net.Http" Condition="'$(TargetFramework)' != 'net6.0'" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\src\Microsoft.Azure.CognitiveServices.Vision.ContentModerator.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@
<ItemGroup>
<PackageReference Include="Azure.Core" />
<PackageReference Include="Azure.Communication.Common" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="System.Text.Json" Condition="'$(TargetFramework)' != 'net6.0'" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<ItemGroup>
<PackageReference Include="Azure.Core" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="System.Text.Json" Condition="'$(TargetFramework)' != 'net6.0'" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Azure.Core" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="System.Text.Json" Condition="'$(TargetFramework)' != 'net6.0'" />
</ItemGroup>
<ItemGroup>
<Compile Include="$(AzureCoreSharedSources)Argument.cs" LinkBase="Shared" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<ItemGroup>
<PackageReference Include="Azure.Core" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="System.Text.Json" Condition="'$(TargetFramework)' != 'net6.0'" />
</ItemGroup>

<!-- Shared source from Azure.Core -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<ItemGroup>
<PackageReference Include="Azure.Core" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="System.Text.Json" Condition="'$(TargetFramework)' != 'net6.0'" />
</ItemGroup>

<!-- Shared source from Azure.Core -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<ItemGroup>
<PackageReference Include="Azure.Core" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="System.Text.Json" Condition="'$(TargetFramework)' != 'net6.0'" />
</ItemGroup>

<!-- Shared source from Azure.Core -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<ItemGroup>
<PackageReference Include="Azure.Core" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="System.Text.Json" Condition="'$(TargetFramework)' != 'net6.0'" />
</ItemGroup>

<!-- Shared source from Azure.Core -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<ItemGroup>
<PackageReference Include="Azure.Core" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="System.Text.Json" Condition="'$(TargetFramework)' != 'net6.0'" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\Shared\src\ClientOptionsExtensions.cs" LinkBase="Shared\Communication" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<ItemGroup>
<PackageReference Include="Azure.Core" />
<PackageReference Include="Azure.Core.Experimental" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="System.Text.Json" Condition="'$(TargetFramework)' != 'net6.0'" />
</ItemGroup>

<!-- Shared source from Azure.Core -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="Azure.Core" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="System.Text.Json" Condition="'$(TargetFramework)' != 'net6.0'" />
</ItemGroup>

<!-- Shared source from Azure.Core -->
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/Azure.Core.Amqp/src/Azure.Core.Amqp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Memory" />
<PackageReference Include="System.Memory" Condition="'$(TargetFramework)' != 'net6.0'" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="Azure.Core" />
<PackageReference Include="Microsoft.CSharp" />
<PackageReference Include="Microsoft.CSharp" Condition="'$(TargetFramework)' != 'net6.0'" />
</ItemGroup>

<ItemGroup>
Expand Down
18 changes: 10 additions & 8 deletions sdk/core/Azure.Core.Experimental/src/JsonData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public T Get<T>(string propertyName, JsonSerializerOptions options)
/// <remarks>If the <see cref="Kind"/> property is not <see cref="JsonValueKind.Object"/> this method throws <see cref="InvalidOperationException"/>.</remarks>
public JsonData? Get(string propertyName)
{
if (EnsureObject().TryGetValue(propertyName, out JsonData value))
if (EnsureObject().TryGetValue(propertyName, out JsonData? value))
{
return value;
}
Expand All @@ -242,7 +242,7 @@ public T Get<T>(string propertyName, JsonSerializerOptions options)
/// <returns>A new instance of <typeparamref name="T"/> constructed from the underlying JSON value.</returns>
public T To<T>(JsonSerializerOptions options)
{
return JsonSerializer.Deserialize<T>(ToJsonString(), options);
return JsonSerializer.Deserialize<T>(ToJsonString(), options)!;
}

/// <summary>
Expand Down Expand Up @@ -919,7 +919,7 @@ public override string ToString()
return ToJsonString();
}

return (_value ?? "<null>").ToString();
return (_value ?? "<null>").ToString()!;
}

/// <inheritdoc />
Expand All @@ -939,7 +939,9 @@ public override bool Equals(object? obj)
}

/// <inheritdoc />
#pragma warning disable CS8767 // Nullability of reference types in type of parameter doesn't match implicitly implemented member (possibly because of nullability attributes).
public bool Equals(JsonData other)
#pragma warning restore CS8767 // Nullability of reference types in type of parameter doesn't match implicitly implemented member (possibly because of nullability attributes).
{
if (_kind != other._kind)
{
Expand Down Expand Up @@ -1043,7 +1045,7 @@ private Dictionary<string, JsonData> EnsureObject()

private JsonData GetPropertyValue(string propertyName)
{
if (EnsureObject().TryGetValue(propertyName, out JsonData element))
if (EnsureObject().TryGetValue(propertyName, out JsonData? element))
{
return element;
}
Expand All @@ -1065,7 +1067,7 @@ private object GetDynamicProperty(string propertyName)
return Length;
}

if (EnsureObject().TryGetValue(propertyName, out JsonData element))
if (EnsureObject().TryGetValue(propertyName, out JsonData? element))
{
return element;
}
Expand Down Expand Up @@ -1203,11 +1205,11 @@ public double AsDouble()

private class MetaObject : DynamicMetaObject
{
private static readonly MethodInfo GetDynamicValueMethod = typeof(JsonData).GetMethod(nameof(GetDynamicProperty), BindingFlags.NonPublic | BindingFlags.Instance);
private static readonly MethodInfo GetDynamicValueMethod = typeof(JsonData).GetMethod(nameof(GetDynamicProperty), BindingFlags.NonPublic | BindingFlags.Instance)!;

private static readonly MethodInfo GetDynamicEnumerableMethod = typeof(JsonData).GetMethod(nameof(GetDynamicEnumerable), BindingFlags.NonPublic | BindingFlags.Instance);
private static readonly MethodInfo GetDynamicEnumerableMethod = typeof(JsonData).GetMethod(nameof(GetDynamicEnumerable), BindingFlags.NonPublic | BindingFlags.Instance)!;

private static readonly MethodInfo SetValueMethod = typeof(JsonData).GetMethod(nameof(SetValue), BindingFlags.NonPublic | BindingFlags.Instance);
private static readonly MethodInfo SetValueMethod = typeof(JsonData).GetMethod(nameof(SetValue), BindingFlags.NonPublic | BindingFlags.Instance)!;

internal MetaObject(Expression parameter, IDynamicMetaObjectProvider value) : base(parameter, BindingRestrictions.Empty, value)
{
Expand Down
10 changes: 5 additions & 5 deletions sdk/core/Azure.Core/src/Azure.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" />
<PackageReference Include="System.Numerics.Vectors" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Condition="'$(TargetFramework)' != 'net6.0'" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" Condition="'$(TargetFramework)' != 'net6.0'" />
<PackageReference Include="System.Numerics.Vectors" Condition="'$(TargetFramework)' != 'net6.0'" />
<PackageReference Include="System.Threading.Tasks.Extensions" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="System.Text.Encodings.Web" />
<PackageReference Include="System.Text.Json" Condition="'$(TargetFramework)' != 'net6.0'" />
<PackageReference Include="System.Text.Encodings.Web" Condition="'$(TargetFramework)' != 'net6.0'" />
<PackageReference Include="System.Memory.Data" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.Spatial" />
<PackageReference Include="System.Text.Encodings.Web" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="System.Text.Encodings.Web" Condition="'$(TargetFramework)' != 'net6.0'" />
<PackageReference Include="System.Text.Json" Condition="'$(TargetFramework)' != 'net6.0'" />
</ItemGroup>

<!-- Pull in Shared Source from Azure.Core -->
Expand Down
6 changes: 3 additions & 3 deletions sdk/core/System.Memory.Data/src/System.Memory.Data.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
<!--The ApiCompatVersion is managed automatically and should not generally be modified manually.-->
<ApiCompatVersion>1.0.2</ApiCompatVersion>
<Nullable>enable</Nullable>
<TargetFrameworks>net461;netstandard2.0;</TargetFrameworks>
<TargetFrameworks>net461;netstandard2.0;net6.0</TargetFrameworks>
<NoWarn>$(NoWarn);AZC0001;AZC0012</NoWarn>
<AssemblyOriginatorKeyFile>Open.snk</AssemblyOriginatorKeyFile>
<PackageIcon>DotNetPackageIcon.png</PackageIcon>
<PackageIconPath>..\$(PackageIcon)</PackageIconPath>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Text.Json" />
<PackageReference Include="System.Text.Encodings.Web" />
<PackageReference Include="System.Text.Json" Condition="'$(TargetFramework)' != 'net6.0'" />
<PackageReference Include="System.Text.Encodings.Web" Condition="'$(TargetFramework)' != 'net6.0'" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<ItemGroup>
<PackageReference Include="Azure.Core" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="System.Text.Json" Condition="'$(TargetFramework)' != 'net6.0'" />
</ItemGroup>

<!-- Common source from Azure.Core -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="Azure.Core" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="System.Text.Json" Condition="'$(TargetFramework)' != 'net6.0'" />
<PackageReference Include="System.Memory.Data" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<PackageReference Include="Microsoft.Azure.Management.ResourceManager" />
<PackageReference Include="Microsoft.Azure.Management.EventGrid" />
<PackageReference Include="Microsoft.Azure.Services.AppAuthentication" />
<PackageReference Include="System.Net.WebSockets.Client" />
<PackageReference Include="System.ValueTuple" />
<PackageReference Include="System.Net.WebSockets.Client" Condition="'$(TargetFramework)' != 'net6.0'" />
<PackageReference Include="System.ValueTuple" Condition="'$(TargetFramework)' != 'net6.0'" />
<PackageReference Include="NUnit" />
<PackageReference Include="Polly" />
<PackageReference Include="System.Threading.Tasks.Extensions" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
<PackageReference Include="CloudNative.CloudEvents.SystemTextJson" />
<!-- This is required to prevent version conflict stemming from The CloudNative.CloudEvents.SystemTestJson depending on -->
<!-- version 5.0.0.-->
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" VersionOverride="5.0.0" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" VersionOverride="5.0.0" Condition="'$(TargetFramework)' != 'net6.0'" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="Moq" />
<PackageReference Include="System.Memory" />
<PackageReference Include="System.Memory" Condition="'$(TargetFramework)' != 'net6.0'" />
<ProjectReference Include="$(AzureCoreTestFramework)" />
<ProjectReference Include="..\..\..\eventgrid\Azure.Messaging.EventGrid\tests\Azure.Messaging.EventGrid.Tests.csproj" />
<Compile Include="$(AzureCoreSharedSources)AppContextSwitchHelper.cs" LinkBase="Shared" />
Expand Down
Loading