Skip to content

Commit 83f8df4

Browse files
authored
Revert "Enable System.Text.Json tests on netfx (#63803)" (#64108)
This reverts commit 34794bc.
1 parent 968746b commit 83f8df4

13 files changed

+6
-43
lines changed

docs/coding-guidelines/project-guidelines.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Pure netstandard configuration:
5252
All supported targets with unique windows/unix build for netcoreapp:
5353
```
5454
<PropertyGroup>
55-
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetFrameworkMinimum)</TargetFrameworks>
55+
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetFrameworkCurrent)</TargetFrameworks>
5656
<PropertyGroup>
5757
```
5858

src/libraries/System.Text.Json/tests/Common/PropertyVisibilityTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,6 @@ public async Task JsonIgnoreAttribute_UnsupportedCollection()
12271227
}
12281228

12291229
[Fact]
1230-
[ActiveIssue("https://github.com/dotnet/runtime/issues/63802", TargetFrameworkMonikers.NetFramework)]
12311230
public async Task JsonIgnoreAttribute_UnsupportedBigInteger()
12321231
{
12331232
string json = @"{""MyBigInteger"":1}";

src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/ContextClasses.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.Collections.Generic;
5+
using System.Reflection;
56
using System.Text.Json.Serialization;
67
using System.Text.Json.Serialization.Metadata;
78

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

1516
public JsonTypeInfo<Location> Location { get; }
1617
public JsonTypeInfo<NumberTypes> NumberTypes { get; }

src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/JsonSerializerContextTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public static void VariousNestingAndVisibilityLevelsAreSupported()
2121
}
2222

2323
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
24-
[ActiveIssue("https://github.com/dotnet/runtime/issues/63802", TargetFrameworkMonikers.NetFramework)]
2524
public static void Converters_AndTypeInfoCreator_NotRooted_WhenMetadataNotPresent()
2625
{
2726
RemoteExecutor.Invoke(

src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/MetadataAndSerializationContextTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.Text.Json.Serialization;
5-
using System.Reflection;
65
using Xunit;
76

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

5149
public sealed class MetadataAndSerializationContextTests : RealWorldContextTests

src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/MetadataContextTests.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.Text.Json.Serialization;
5-
using System.Reflection;
65
using Xunit;
76

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

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

135132
[JsonConverter(typeof(JsonStringEnumConverter))]

src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/MixedModeContextTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.Text.Json.Serialization;
5-
using System.Reflection;
65
using Xunit;
76

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

5149
public sealed class MixedModeContextTests : RealWorldContextTests

src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/Serialization/PropertyVisibilityTests.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,10 @@ public override async Task HonorJsonPropertyName_PrivateSetter()
249249
[JsonSerializable(typeof(ClassWithNewSlotAttributedDecimalProperty))]
250250
[JsonSerializable(typeof(ClassWithNewSlotDecimalProperty))]
251251
[JsonSerializable(typeof(LargeStructWithValueAndReferenceTypes))]
252-
#if !NETFRAMEWORK
253252
[JsonSerializable(typeof(ClassWithUnsupportedBigInteger))]
254253
[JsonSerializable(typeof(WrapperForClassWithUnsupportedBigInteger))]
255254
[JsonSerializable(typeof(ClassWithIgnoredUnsupportedBigInteger))]
256255
[JsonSerializable(typeof(WrapperForClassWithIgnoredUnsupportedBigInteger))]
257-
#endif
258256
[JsonSerializable(typeof(ClassWithThingsToIgnore))]
259257
[JsonSerializable(typeof(ClassWithMixedPropertyAccessors_PropertyAttributes))]
260258
[JsonSerializable(typeof(ClassWithPropertyPolicyConflictWhichThrows))]
@@ -424,12 +422,10 @@ public override async Task JsonIgnoreCondition_WhenWritingNull_OnValueType_Fail_
424422
[JsonSerializable(typeof(ClassWithNewSlotAttributedDecimalProperty))]
425423
[JsonSerializable(typeof(ClassWithNewSlotDecimalProperty))]
426424
[JsonSerializable(typeof(LargeStructWithValueAndReferenceTypes))]
427-
#if !NETFRAMEWORK
428425
[JsonSerializable(typeof(ClassWithUnsupportedBigInteger))]
429426
[JsonSerializable(typeof(WrapperForClassWithUnsupportedBigInteger))]
430427
[JsonSerializable(typeof(ClassWithIgnoredUnsupportedBigInteger))]
431428
[JsonSerializable(typeof(WrapperForClassWithIgnoredUnsupportedBigInteger))]
432-
#endif
433429
[JsonSerializable(typeof(ClassWithThingsToIgnore))]
434430
[JsonSerializable(typeof(ClassWithMixedPropertyAccessors_PropertyAttributes))]
435431
[JsonSerializable(typeof(ClassWithPropertyPolicyConflictWhichThrows))]

src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/SerializationContextTests.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.Text.Json.Serialization;
5-
using System.Reflection;
65
using Xunit;
76

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

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

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

132128
public class SerializationContextTests : RealWorldContextTests

src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/System.Text.Json.SourceGeneration.Tests.targets

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<TargetFrameworks>$(NetCoreAppCurrent);$(NetFrameworkMinimum)</TargetFrameworks>
3+
<TargetFrameworks>$(NetCoreAppCurrent);$(NetFrameworkCurrent)</TargetFrameworks>
44
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
55
<IncludeRemoteExecutor>true</IncludeRemoteExecutor>
66
<!-- SYSLIB0020: JsonSerializerOptions.IgnoreNullValues is obsolete -->
@@ -86,17 +86,6 @@
8686
<Compile Include="TestClasses.CustomConverters.cs" />
8787
</ItemGroup>
8888

89-
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
90-
<ProjectReference Include="..\..\src\System.Text.Json.csproj" />
91-
<ProjectReference Include="$(LibrariesProjectRoot)System.Collections.Immutable\src\System.Collections.Immutable.csproj" />
92-
</ItemGroup>
93-
94-
<ItemGroup Condition="'$(TargetFramework)' != '$(NetCoreAppCurrent)'">
95-
<Compile Include="$(CommonPath)System\Runtime\CompilerServices\IsExternalInit.cs" Link="Common\System\Runtime\CompilerServices\IsExternalInit.cs" />
96-
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\DynamicDependencyAttribute.cs" />
97-
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\DynamicallyAccessedMemberTypes.cs" />
98-
</ItemGroup>
99-
10089
<Target Name="FixIncrementalCoreCompileWithAnalyzers" BeforeTargets="CoreCompile">
10190
<ItemGroup>
10291
<CustomAdditionalCompileInputs Include="@(Analyzer)" />

src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/CompilationHelper.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System.CodeDom.Compiler;
54
using System.Collections.Generic;
65
using System.Collections.Immutable;
76
using System.Globalization;
@@ -32,19 +31,16 @@ public static Compilation CreateCompilation(
3231
// Bypass System.Runtime error.
3332
Assembly systemRuntimeAssembly = Assembly.Load("System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
3433
Assembly systemCollectionsAssembly = Assembly.Load("System.Collections, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
35-
// Needed on netfx
3634
string systemRuntimeAssemblyPath = systemRuntimeAssembly.Location;
3735
string systemCollectionsAssemblyPath = systemCollectionsAssembly.Location;
3836

3937
List<MetadataReference> references = new List<MetadataReference> {
4038
MetadataReference.CreateFromFile(typeof(object).Assembly.Location),
4139
MetadataReference.CreateFromFile(typeof(Attribute).Assembly.Location),
4240
MetadataReference.CreateFromFile(typeof(Type).Assembly.Location),
43-
MetadataReference.CreateFromFile(typeof(KeyValuePair<,>).Assembly.Location),
41+
MetadataReference.CreateFromFile(typeof(KeyValuePair).Assembly.Location),
4442
MetadataReference.CreateFromFile(typeof(ContractNamespaceAttribute).Assembly.Location),
4543
MetadataReference.CreateFromFile(typeof(JavaScriptEncoder).Assembly.Location),
46-
MetadataReference.CreateFromFile(typeof(GeneratedCodeAttribute).Assembly.Location),
47-
MetadataReference.CreateFromFile(typeof(ReadOnlySpan<>).Assembly.Location),
4844
MetadataReference.CreateFromFile(systemRuntimeAssemblyPath),
4945
MetadataReference.CreateFromFile(systemCollectionsAssemblyPath),
5046
};

src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,6 @@ public void UsePrivates()
450450
}
451451

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

514513
[Fact]
515-
[ActiveIssue("https://github.com/dotnet/runtime/issues/63802", TargetFrameworkMonikers.NetFramework)]
516514
public void RecordInExternalAssembly()
517515
{
518516
// Compile the referenced assembly first.

src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/System.Text.Json.SourceGeneration.Unit.Tests.targets

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<TargetFrameworks>$(NetCoreAppCurrent);$(NetFrameworkMinimum)</TargetFrameworks>
3+
<TargetFrameworks>$(NetCoreAppCurrent);$(NetFrameworkCurrent)</TargetFrameworks>
44
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
55
</PropertyGroup>
66

@@ -17,10 +17,6 @@
1717
<Compile Include="TypeWrapperTests.cs" />
1818
</ItemGroup>
1919

20-
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
21-
<Reference Include="System" />
22-
</ItemGroup>
23-
2420
<Target Name="FixIncrementalCoreCompileWithAnalyzers" BeforeTargets="CoreCompile">
2521
<ItemGroup>
2622
<CustomAdditionalCompileInputs Include="@(Analyzer)" />

0 commit comments

Comments
 (0)