Skip to content

Commit

Permalink
Revert "Enable System.Text.Json tests on netfx (#63803)" (#64108)
Browse files Browse the repository at this point in the history
This reverts commit 34794bc.
  • Loading branch information
agocke authored Jan 21, 2022
1 parent 968746b commit 83f8df4
Show file tree
Hide file tree
Showing 13 changed files with 6 additions and 43 deletions.
2 changes: 1 addition & 1 deletion docs/coding-guidelines/project-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Pure netstandard configuration:
All supported targets with unique windows/unix build for netcoreapp:
```
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetFrameworkMinimum)</TargetFrameworks>
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetFrameworkCurrent)</TargetFrameworks>
<PropertyGroup>
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,6 @@ public async Task JsonIgnoreAttribute_UnsupportedCollection()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/63802", TargetFrameworkMonikers.NetFramework)]
public async Task JsonIgnoreAttribute_UnsupportedBigInteger()
{
string json = @"{""MyBigInteger"":1}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.Reflection;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization.Metadata;

Expand All @@ -10,7 +11,7 @@ namespace System.Text.Json.SourceGeneration.Tests
public interface ITestContext
{
public JsonSourceGenerationMode JsonSourceGenerationMode { get; }
public bool IsIncludeFieldsEnabled { get; }
public bool IsIncludeFieldsEnabled => GetType().GetCustomAttribute<JsonSourceGenerationOptionsAttribute>()?.IncludeFields ?? false;

public JsonTypeInfo<Location> Location { get; }
public JsonTypeInfo<NumberTypes> NumberTypes { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public static void VariousNestingAndVisibilityLevelsAreSupported()
}

[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/63802", TargetFrameworkMonikers.NetFramework)]
public static void Converters_AndTypeInfoCreator_NotRooted_WhenMetadataNotPresent()
{
RemoteExecutor.Invoke(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Text.Json.Serialization;
using System.Reflection;
using Xunit;

namespace System.Text.Json.SourceGeneration.Tests
Expand Down Expand Up @@ -45,7 +44,6 @@ namespace System.Text.Json.SourceGeneration.Tests
internal partial class MetadataAndSerializationContext : JsonSerializerContext, ITestContext
{
public JsonSourceGenerationMode JsonSourceGenerationMode => JsonSourceGenerationMode.Default;
public bool IsIncludeFieldsEnabled => GetType().GetCustomAttribute<JsonSourceGenerationOptionsAttribute>()?.IncludeFields ?? false;
}

public sealed class MetadataAndSerializationContextTests : RealWorldContextTests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Text.Json.Serialization;
using System.Reflection;
using Xunit;

namespace System.Text.Json.SourceGeneration.Tests
Expand Down Expand Up @@ -44,7 +43,6 @@ namespace System.Text.Json.SourceGeneration.Tests
internal partial class MetadataWithPerTypeAttributeContext : JsonSerializerContext, ITestContext
{
public JsonSourceGenerationMode JsonSourceGenerationMode => JsonSourceGenerationMode.Metadata;
public bool IsIncludeFieldsEnabled => GetType().GetCustomAttribute<JsonSourceGenerationOptionsAttribute>()?.IncludeFields ?? false;
}

public sealed class MetadataWithPerTypeAttributeContextTests : RealWorldContextTests
Expand Down Expand Up @@ -129,7 +127,6 @@ public override void EnsureFastPathGeneratedAsExpected()
internal partial class MetadataContext : JsonSerializerContext, ITestContext
{
public JsonSourceGenerationMode JsonSourceGenerationMode => JsonSourceGenerationMode.Metadata;
public bool IsIncludeFieldsEnabled => GetType().GetCustomAttribute<JsonSourceGenerationOptionsAttribute>()?.IncludeFields ?? false;
}

[JsonConverter(typeof(JsonStringEnumConverter))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Text.Json.Serialization;
using System.Reflection;
using Xunit;

namespace System.Text.Json.SourceGeneration.Tests
Expand Down Expand Up @@ -45,7 +44,6 @@ namespace System.Text.Json.SourceGeneration.Tests
internal partial class MixedModeContext : JsonSerializerContext, ITestContext
{
public JsonSourceGenerationMode JsonSourceGenerationMode => JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization;
public bool IsIncludeFieldsEnabled => GetType().GetCustomAttribute<JsonSourceGenerationOptionsAttribute>()?.IncludeFields ?? false;
}

public sealed class MixedModeContextTests : RealWorldContextTests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,10 @@ public override async Task HonorJsonPropertyName_PrivateSetter()
[JsonSerializable(typeof(ClassWithNewSlotAttributedDecimalProperty))]
[JsonSerializable(typeof(ClassWithNewSlotDecimalProperty))]
[JsonSerializable(typeof(LargeStructWithValueAndReferenceTypes))]
#if !NETFRAMEWORK
[JsonSerializable(typeof(ClassWithUnsupportedBigInteger))]
[JsonSerializable(typeof(WrapperForClassWithUnsupportedBigInteger))]
[JsonSerializable(typeof(ClassWithIgnoredUnsupportedBigInteger))]
[JsonSerializable(typeof(WrapperForClassWithIgnoredUnsupportedBigInteger))]
#endif
[JsonSerializable(typeof(ClassWithThingsToIgnore))]
[JsonSerializable(typeof(ClassWithMixedPropertyAccessors_PropertyAttributes))]
[JsonSerializable(typeof(ClassWithPropertyPolicyConflictWhichThrows))]
Expand Down Expand Up @@ -424,12 +422,10 @@ public override async Task JsonIgnoreCondition_WhenWritingNull_OnValueType_Fail_
[JsonSerializable(typeof(ClassWithNewSlotAttributedDecimalProperty))]
[JsonSerializable(typeof(ClassWithNewSlotDecimalProperty))]
[JsonSerializable(typeof(LargeStructWithValueAndReferenceTypes))]
#if !NETFRAMEWORK
[JsonSerializable(typeof(ClassWithUnsupportedBigInteger))]
[JsonSerializable(typeof(WrapperForClassWithUnsupportedBigInteger))]
[JsonSerializable(typeof(ClassWithIgnoredUnsupportedBigInteger))]
[JsonSerializable(typeof(WrapperForClassWithIgnoredUnsupportedBigInteger))]
#endif
[JsonSerializable(typeof(ClassWithThingsToIgnore))]
[JsonSerializable(typeof(ClassWithMixedPropertyAccessors_PropertyAttributes))]
[JsonSerializable(typeof(ClassWithPropertyPolicyConflictWhichThrows))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Text.Json.Serialization;
using System.Reflection;
using Xunit;

namespace System.Text.Json.SourceGeneration.Tests
Expand Down Expand Up @@ -45,7 +44,6 @@ namespace System.Text.Json.SourceGeneration.Tests
internal partial class SerializationContext : JsonSerializerContext, ITestContext
{
public JsonSourceGenerationMode JsonSourceGenerationMode => JsonSourceGenerationMode.Serialization;
public bool IsIncludeFieldsEnabled => GetType().GetCustomAttribute<JsonSourceGenerationOptionsAttribute>()?.IncludeFields ?? false;
}

[JsonSerializable(typeof(Location), GenerationMode = JsonSourceGenerationMode.Serialization)]
Expand Down Expand Up @@ -85,7 +83,6 @@ internal partial class SerializationContext : JsonSerializerContext, ITestContex
internal partial class SerializationWithPerTypeAttributeContext : JsonSerializerContext, ITestContext
{
public JsonSourceGenerationMode JsonSourceGenerationMode => JsonSourceGenerationMode.Serialization;
public bool IsIncludeFieldsEnabled => GetType().GetCustomAttribute<JsonSourceGenerationOptionsAttribute>()?.IncludeFields ?? false;
}

[JsonSourceGenerationOptions(PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase, IncludeFields = true)]
Expand Down Expand Up @@ -126,7 +123,6 @@ internal partial class SerializationWithPerTypeAttributeContext : JsonSerializer
internal partial class SerializationContextWithCamelCase : JsonSerializerContext, ITestContext
{
public JsonSourceGenerationMode JsonSourceGenerationMode => JsonSourceGenerationMode.Serialization;
public bool IsIncludeFieldsEnabled => GetType().GetCustomAttribute<JsonSourceGenerationOptionsAttribute>()?.IncludeFields ?? false;
}

public class SerializationContextTests : RealWorldContextTests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent);$(NetFrameworkMinimum)</TargetFrameworks>
<TargetFrameworks>$(NetCoreAppCurrent);$(NetFrameworkCurrent)</TargetFrameworks>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<IncludeRemoteExecutor>true</IncludeRemoteExecutor>
<!-- SYSLIB0020: JsonSerializerOptions.IgnoreNullValues is obsolete -->
Expand Down Expand Up @@ -86,17 +86,6 @@
<Compile Include="TestClasses.CustomConverters.cs" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<ProjectReference Include="..\..\src\System.Text.Json.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Collections.Immutable\src\System.Collections.Immutable.csproj" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != '$(NetCoreAppCurrent)'">
<Compile Include="$(CommonPath)System\Runtime\CompilerServices\IsExternalInit.cs" Link="Common\System\Runtime\CompilerServices\IsExternalInit.cs" />
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\DynamicDependencyAttribute.cs" />
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\DynamicallyAccessedMemberTypes.cs" />
</ItemGroup>

<Target Name="FixIncrementalCoreCompileWithAnalyzers" BeforeTargets="CoreCompile">
<ItemGroup>
<CustomAdditionalCompileInputs Include="@(Analyzer)" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Globalization;
Expand Down Expand Up @@ -32,19 +31,16 @@ public static Compilation CreateCompilation(
// Bypass System.Runtime error.
Assembly systemRuntimeAssembly = Assembly.Load("System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
Assembly systemCollectionsAssembly = Assembly.Load("System.Collections, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
// Needed on netfx
string systemRuntimeAssemblyPath = systemRuntimeAssembly.Location;
string systemCollectionsAssemblyPath = systemCollectionsAssembly.Location;

List<MetadataReference> references = new List<MetadataReference> {
MetadataReference.CreateFromFile(typeof(object).Assembly.Location),
MetadataReference.CreateFromFile(typeof(Attribute).Assembly.Location),
MetadataReference.CreateFromFile(typeof(Type).Assembly.Location),
MetadataReference.CreateFromFile(typeof(KeyValuePair<,>).Assembly.Location),
MetadataReference.CreateFromFile(typeof(KeyValuePair).Assembly.Location),
MetadataReference.CreateFromFile(typeof(ContractNamespaceAttribute).Assembly.Location),
MetadataReference.CreateFromFile(typeof(JavaScriptEncoder).Assembly.Location),
MetadataReference.CreateFromFile(typeof(GeneratedCodeAttribute).Assembly.Location),
MetadataReference.CreateFromFile(typeof(ReadOnlySpan<>).Assembly.Location),
MetadataReference.CreateFromFile(systemRuntimeAssemblyPath),
MetadataReference.CreateFromFile(systemCollectionsAssemblyPath),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,6 @@ public void UsePrivates()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/63802", TargetFrameworkMonikers.NetFramework)]
public void Record()
{
// Compile the referenced assembly first.
Expand Down Expand Up @@ -512,7 +511,6 @@ public record AppRecord(int Id)
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/63802", TargetFrameworkMonikers.NetFramework)]
public void RecordInExternalAssembly()
{
// Compile the referenced assembly first.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent);$(NetFrameworkMinimum)</TargetFrameworks>
<TargetFrameworks>$(NetCoreAppCurrent);$(NetFrameworkCurrent)</TargetFrameworks>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
</PropertyGroup>

Expand All @@ -17,10 +17,6 @@
<Compile Include="TypeWrapperTests.cs" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<Reference Include="System" />
</ItemGroup>

<Target Name="FixIncrementalCoreCompileWithAnalyzers" BeforeTargets="CoreCompile">
<ItemGroup>
<CustomAdditionalCompileInputs Include="@(Analyzer)" />
Expand Down

0 comments on commit 83f8df4

Please sign in to comment.