Skip to content

Commit

Permalink
dropping unsupported netcore 3.1 target and fixing JSON dependency (#507
Browse files Browse the repository at this point in the history
)
  • Loading branch information
pdeligia authored Jul 16, 2024
1 parent 20a4617 commit 5d80bea
Show file tree
Hide file tree
Showing 43 changed files with 47 additions and 167 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/test-coyote.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
- name: Setup .NET Core 3.1 SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'
- name: Setup debugging tools
if: ${{ matrix.platform == 'windows-latest' }}
run: |
Expand Down
5 changes: 0 additions & 5 deletions Common/build.props
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,12 @@
<Framework462Installed>false</Framework462Installed>
<Framework462Installed Condition="'$(BUILD_NET462)'=='yes'">true</Framework462Installed>
<NetStandard2Supported Condition="'$(NetStandard2Supported)'==''">true</NetStandard2Supported>
<NetCore31Supported Condition="'$(NetCore31Supported)'==''">true</NetCore31Supported>
<NetCore31Installed>false</NetCore31Installed>
<NetCore31Installed Condition="$(GlobalVersion.StartsWith('3.1'))">true</NetCore31Installed>
<NetCore31Installed Condition="'$(BUILD_NETCORE31)'=='yes'">true</NetCore31Installed>
<Net6Supported Condition="'$(Net6Supported)'==''">true</Net6Supported>
<Net6Installed>false</Net6Installed>
<Net6Installed Condition="$(GlobalVersion.StartsWith('6.0'))">true</Net6Installed>
<Net6Installed Condition="'$(BUILD_NET6)'=='yes'">true</Net6Installed>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks Condition="'$(NetStandard2Supported)'">$(TargetFrameworks);netstandard2.0</TargetFrameworks>
<TargetFrameworks Condition="'$(NetCore31Installed)' and '$(NetCore31Supported)'">$(TargetFrameworks);netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="'$(Net6Installed)' and '$(Net6Supported)'">$(TargetFrameworks);net6.0</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="'$(OS)'=='Windows_NT'">
Expand Down
6 changes: 6 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## vNext
- Upgraded the `System.Text.Json` package to `v8.0.4` for the `netstandard2.0`
target framework, due to a vulnerability.
- Dropped support for the `netcoreapp3.1` target framework, which reached end of
life.

## v1.7.11
- Added support for the `net8.0` target framework.
- Added support to optionally explore a race condition when using the
Expand Down
35 changes: 0 additions & 35 deletions Scripts/CI/azure-nuget-sign-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ steps:
inputs:
version: 6.0.x

- task: UseDotNet@2
displayName: 'Install .NET Core 3.1 SDK'
inputs:
version: 3.1.x

- task: UseDotNet@2
displayName: 'Install .NET Core 2.1 SDK'
inputs:
Expand Down Expand Up @@ -98,36 +93,6 @@ steps:
}
]
- task: EsrpCodeSigning@2
displayName: 'ESRP CodeSigning .NET Core 3.1'
inputs:
ConnectedServiceName: CoyoteNugetSign
FolderPath: bin\netcoreapp3.1
signConfigType: inlineSignParams
inlineOperation: |
[
{
"KeyCode": "CP-230012",
"OperationCode": "SigntoolSign",
"Parameters": {
"OpusName": "Microsoft.Coyote",
"OpusInfo": "https://github.com/Microsoft/Coyote",
"FileDigest": "/fd \"SHA256\"",
"PageHash": "/PH",
"TimeStamp": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
},
"ToolName": "sign",
"ToolVersion": "1.0"
},
{
"KeyCode": "CP-230012",
"OperationCode": "SigntoolVerify",
"Parameters": {},
"ToolName": "sign",
"ToolVersion": "1.0"
}
]
- task: EsrpCodeSigning@2
displayName: 'ESRP CodeSigning .NET Standard 2.0'
inputs:
Expand Down
6 changes: 0 additions & 6 deletions Scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ if ($host.Version.Major -lt 7)
$dotnet = "dotnet"
$dotnet_sdk_path = FindDotNetSdkPath -dotnet $dotnet
$version_net4 = $IsWindows -and (Get-ItemProperty "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full").Release -ge 528040
$version_netcore31 = FindMatchingVersion -path $dotnet_sdk_path -version "3.1.0"
$version_net6 = FindMatchingVersion -path $dotnet_sdk_path -version "6.0.0"
$sdk_version = FindDotNetSdkVersion -dotnet_sdk_path $dotnet_sdk_path

Expand All @@ -44,11 +43,6 @@ if ($ci.IsPresent) {
$extra_frameworks = $extra_frameworks + " /p:BUILD_NET462=yes"
}

if ($null -ne $version_netcore31 -and $version_netcore31 -ne $sdk_version) {
# Build .NET Core 3.1 as well as the latest version.
$extra_frameworks = $extra_frameworks + " /p:BUILD_NETCORE31=yes"
}

if ($null -ne $version_net6 -and $version_net6 -ne $sdk_version) {
# Build .NET 6.0 as well as the latest version.
$extra_frameworks = $extra_frameworks + " /p:BUILD_NET6=yes"
Expand Down
2 changes: 1 addition & 1 deletion Scripts/common.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function Invoke-CoyoteTool([String]$cmd, [String]$dotnet, [String]$framework, [S
$command = "$coyote $cmd $target"
}

if ($command -eq "rewrite" -and $framework -ne "netcoreapp3.1" -and $framework -ne "net6.0" -and $framework -ne "net8.0" -and $IsWindows) {
if ($command -eq "rewrite" -and $framework -ne "net6.0" -and $framework -ne "net8.0" -and $IsWindows) {
# NOTE: Mono.Cecil cannot sign assemblies on unix platforms.
$command = "$command -snk $key"
}
Expand Down
2 changes: 1 addition & 1 deletion Scripts/run-tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Licensed under the MIT License.

param(
[ValidateSet("net8.0", "net6.0", "netcoreapp3.1", "net462")]
[ValidateSet("net8.0", "net6.0", "net462")]
[string]$framework = "net8.0",
[ValidateSet("all", "runtime", "rewriting", "testing", "actors", "actors-testing", "tools")]
[string]$test = "all",
Expand Down
6 changes: 3 additions & 3 deletions Source/Core/Runtime/CoyoteRuntime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2494,7 +2494,7 @@ internal void ProcessUnhandledExceptionInOperation(ControlledOperation op, Excep
/// </summary>
private static string FormatExceptionStackTrace(Exception exception)
{
#if NET || NETCOREAPP3_1
#if NET
string[] lines = exception.ToString().Split(Environment.NewLine, StringSplitOptions.None);
#else
string[] lines = exception.ToString().Split(new[] { Environment.NewLine }, StringSplitOptions.None);
Expand All @@ -2516,7 +2516,7 @@ private static string FormatExceptionStackTrace(Exception exception)
private static string FormatUncontrolledStackTrace(StackTrace trace)
{
StringBuilder sb = new StringBuilder();
#if NET || NETCOREAPP3_1
#if NET
string[] lines = trace.ToString().Split(Environment.NewLine, StringSplitOptions.None);
#else
string[] lines = trace.ToString().Split(new[] { Environment.NewLine }, StringSplitOptions.None);
Expand All @@ -2535,7 +2535,7 @@ private static string FormatUncontrolledStackTrace(StackTrace trace)
private static string FormatSpecificationMonitorStackTrace(StackTrace trace)
{
StringBuilder sb = new StringBuilder();
#if NET || NETCOREAPP3_1
#if NET
string[] lines = trace.ToString().Split(Environment.NewLine, StringSplitOptions.None);
#else
string[] lines = trace.ToString().Split(new[] { Environment.NewLine }, StringSplitOptions.None);
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Testing/Interleaving/InterleavingStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ internal bool GetNextInteger(ControlledOperation current, int maxValue, out int
/// </summary>
private string FormatReplayError(int step, string reason)
{
#if NET || NETCOREAPP3_1
#if NET
string[] traceTokens = new StackTrace().ToString().Split(Environment.NewLine, StringSplitOptions.RemoveEmptyEntries);
#else
string[] traceTokens = new StackTrace().ToString().Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using Microsoft.Coyote.Runtime;
using Mono.Cecil;
using Mono.Cecil.Cil;
#if NET || NETCOREAPP3_1
#if NET
using HttpClient = Microsoft.Coyote.Rewriting.Types.Net.Http.HttpClient;
#endif
using NameCache = Microsoft.Coyote.Rewriting.Types.NameCache;
Expand Down Expand Up @@ -101,7 +101,7 @@ instruction.Operand is MethodReference methodReference &&
this.Processor.InsertAfter(instruction, newInstruction);
this.IsMethodBodyModified = true;
}
#if NET || NETCOREAPP3_1
#if NET
else if (IsSystemType(resolvedReturnType) && resolvedReturnType.FullName == NameCache.HttpClient)
{
MethodReference interceptionMethod = this.CreateInterceptionMethod(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ internal TypeRewritingPass(RewritingOptions options, IEnumerable<AssemblyInfo> v
this.KnownTypes[NameCache.EventWaitHandle] = typeof(Types.Threading.EventWaitHandle);
this.KnownTypes[NameCache.WaitHandle] = typeof(Types.Threading.WaitHandle);

#if NET || NETCOREAPP3_1
#if NET
// Populate the map with the known HTTP and web-related types.
this.KnownTypes[NameCache.HttpClient] = typeof(Types.Net.Http.HttpClient);
this.KnownTypes[NameCache.HttpRequestMessage] = typeof(Types.Net.Http.HttpRequestMessage);
Expand Down
3 changes: 1 addition & 2 deletions Source/Test/Rewriting/RewritingOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ private static bool TryResolveTargetFramework(Assembly assembly, out string reso
{
var targetFramework = assembly?.GetCustomAttributes(typeof(TargetFrameworkAttribute), false)
.SingleOrDefault() as TargetFrameworkAttribute;
#if NET || NETCOREAPP3_1
#if NET
var tokens = targetFramework?.FrameworkName.Split(",Version=", StringSplitOptions.None);
#else
var tokens = targetFramework?.FrameworkName.Split(new[] { ",Version=" }, StringSplitOptions.None);
Expand All @@ -310,7 +310,6 @@ private static bool TryResolveTargetFramework(Assembly assembly, out string reso
{
resolvedTargetFramework = tokens[1] is "v8.0" ? "net8.0" :
tokens[1] is "v6.0" ? "net6.0" :
tokens[1] is "v3.1" ? "netcoreapp3.1" :
resolvedTargetFramework;
}
else if (tokens[0] == ".NETFramework")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static void Add(SystemConcurrent.ConcurrentBag<T> instance, T item)
instance.Add(item);
}

#if NET || NETCOREAPP3_1
#if NET
/// <summary>
/// Removes all objects from the concurrent bag.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public static TValue AddOrUpdate(SystemConcurrent.ConcurrentDictionary<TKey, TVa
return instance.AddOrUpdate(key, addValue, updateValueFactory);
}

#if NET || NETCOREAPP3_1
#if NET
/// <summary>
/// Adds a key/value pair to the concurrent dictionary if the key does not
/// already exist, or updates a key/value pair in the concurrent dictionary
Expand Down Expand Up @@ -201,7 +201,7 @@ public static TValue GetOrAdd(SystemConcurrent.ConcurrentDictionary<TKey, TValue
return instance.GetOrAdd(key, value);
}

#if NET || NETCOREAPP3_1
#if NET
/// <summary>
/// Adds a key/value pair to the concurrent dictionary if the key does not already exist.
/// Returns the new value, or the existing value if the key already exists.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static bool get_IsEmpty(SystemConcurrent.ConcurrentQueue<T> instance)
return instance.IsEmpty;
}

#if NET || NETCOREAPP3_1
#if NET
/// <summary>
/// Removes all objects from the concurrent queue.
/// </summary>
Expand Down
6 changes: 3 additions & 3 deletions Source/Test/Rewriting/Types/Collections/Generic/Dictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static SystemGenerics.Dictionary<TKey, TValue> Create(
new Wrapper(capacity, comparer) :
new SystemGenerics.Dictionary<TKey, TValue>(capacity, comparer);

#if NET || NETCOREAPP3_1
#if NET
/// <summary>
/// Initializes a new dictionary instance class that contains elements copied
/// from the specified enumerable.
Expand Down Expand Up @@ -263,7 +263,7 @@ public static void OnDeserialization(SystemGenerics.Dictionary<TKey, TValue> ins
instance.OnDeserialization(sender);
}

#if NET || NETCOREAPP3_1
#if NET
/// <summary>
/// Ensures that the dictionary can hold up to a specified number of entries without
/// any further expansion of its backing storage.
Expand Down Expand Up @@ -365,7 +365,7 @@ internal Wrapper(SystemGenerics.IDictionary<TKey, TValue> dictionary,
internal Wrapper(SystemGenerics.IEqualityComparer<TKey> comparer)
: base(comparer) => this.Setup();

#if NET || NETCOREAPP3_1
#if NET
/// <summary>
/// Initializes a new instance of the <see cref="Wrapper"/> class.
/// </summary>
Expand Down
6 changes: 3 additions & 3 deletions Source/Test/Rewriting/Types/Collections/Generic/HashSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static SystemGenerics.HashSet<T> Create(SystemGenerics.IEnumerable<T> col
new Wrapper(collection, comparer) :
new SystemGenerics.HashSet<T>(collection, comparer);

#if NET || NETCOREAPP3_1
#if NET
/// <summary>
/// Initializes a hash set instance class that is empty, but has reserved
/// space for 'capacity' items and and uses the default equality comparer for the set type.
Expand Down Expand Up @@ -314,7 +314,7 @@ public static void UnionWith(SystemGenerics.HashSet<T> instance, SystemGenerics.
instance.UnionWith(other);
}

#if NET || NETCOREAPP3_1
#if NET
/// <summary>
/// Ensures that this hash set object can hold the specified number of elements without growing.
/// </summary>
Expand Down Expand Up @@ -379,7 +379,7 @@ internal Wrapper(SystemGenerics.IEqualityComparer<T> comparer)
internal Wrapper(SerializationInfo info, StreamingContext context)
: base(info, context) => this.Setup();

Check warning on line 380 in Source/Test/Rewriting/Types/Collections/Generic/HashSet.cs

View workflow job for this annotation

GitHub Actions / Build and test Coyote (macos-latest)

'HashSet<T>.HashSet(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)

Check warning on line 380 in Source/Test/Rewriting/Types/Collections/Generic/HashSet.cs

View workflow job for this annotation

GitHub Actions / Build and test Coyote (macos-latest)

'HashSet<T>.HashSet(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)

Check warning on line 380 in Source/Test/Rewriting/Types/Collections/Generic/HashSet.cs

View workflow job for this annotation

GitHub Actions / Build and test Coyote (ubuntu-latest)

'HashSet<T>.HashSet(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)

Check warning on line 380 in Source/Test/Rewriting/Types/Collections/Generic/HashSet.cs

View workflow job for this annotation

GitHub Actions / Build and test Coyote (ubuntu-latest)

'HashSet<T>.HashSet(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)

Check warning on line 380 in Source/Test/Rewriting/Types/Collections/Generic/HashSet.cs

View workflow job for this annotation

GitHub Actions / Build and test Coyote (windows-latest)

'HashSet<T>.HashSet(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)

Check warning on line 380 in Source/Test/Rewriting/Types/Collections/Generic/HashSet.cs

View workflow job for this annotation

GitHub Actions / Build and test Coyote (windows-latest)

'HashSet<T>.HashSet(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)

Check warning on line 380 in Source/Test/Rewriting/Types/Collections/Generic/HashSet.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

'HashSet<T>.HashSet(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)

Check warning on line 380 in Source/Test/Rewriting/Types/Collections/Generic/HashSet.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

'HashSet<T>.HashSet(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)

#if NET || NETCOREAPP3_1
#if NET
/// <summary>
/// Initializes a new instance of the <see cref="Wrapper"/> class.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions Source/Test/Rewriting/Types/NameCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using SystemCompiler = System.Runtime.CompilerServices;
using SystemConcurrentCollections = System.Collections.Concurrent;
using SystemGenericCollections = System.Collections.Generic;
#if NET || NETCOREAPP3_1
#if NET
using SystemNetHttp = System.Net.Http;
#endif
using SystemTasks = System.Threading.Tasks;
Expand Down Expand Up @@ -89,7 +89,7 @@ internal static class NameCache
internal static string ConcurrentQueue { get; } = typeof(SystemConcurrentCollections.ConcurrentQueue<>).FullName;
internal static string ConcurrentStack { get; } = typeof(SystemConcurrentCollections.ConcurrentStack<>).FullName;

#if NET || NETCOREAPP3_1
#if NET
internal static string HttpClient { get; } = typeof(SystemNetHttp.HttpClient).FullName;
internal static string HttpRequestMessage { get; } = typeof(SystemNetHttp.HttpRequestMessage).FullName;
#endif
Expand Down
2 changes: 1 addition & 1 deletion Source/Test/Rewriting/Types/Net/Http/HttpClient.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

#if NET || NETCOREAPP3_1
#if NET
using System;
using System.Reflection;
using SystemHttpClient = System.Net.Http.HttpClient;
Expand Down
2 changes: 1 addition & 1 deletion Source/Test/Rewriting/Types/Net/Http/HttpMessageHandler.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

#if NET || NETCOREAPP3_1
#if NET
using SystemCancellationToken = System.Threading.CancellationToken;
using SystemDelegatingHandler = System.Net.Http.DelegatingHandler;
using SystemHttpClientHandler = System.Net.Http.HttpClientHandler;
Expand Down
2 changes: 1 addition & 1 deletion Source/Test/Rewriting/Types/Net/Http/HttpRequestHeader.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

#if NET || NETCOREAPP3_1
#if NET
namespace Microsoft.Coyote.Rewriting.Types.Net.Http
{
/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Source/Test/Rewriting/Types/Net/Http/HttpRequestMessage.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

#if NET || NETCOREAPP3_1
#if NET
using System;
using Microsoft.Coyote.Runtime;
using SystemHttpMethod = System.Net.Http.HttpMethod;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

#if NET || NETCOREAPP3_1
#if NET
using System;
using Microsoft.Coyote.Rewriting.Types.Net.Http;
using Microsoft.Coyote.Runtime;
Expand Down
2 changes: 1 addition & 1 deletion Source/Test/SystematicTesting/Reports/TraceReport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ internal static ExecutionTrace FromJson(Configuration configuration)
string decisionToken = tokens[1];
if (decisionToken.StartsWith("sp("))
{
#if NET || NETCOREAPP3_1
#if NET
SchedulingPointType sp = Enum.Parse<SchedulingPointType>(decisionToken.Substring(
3, decisionToken.Length - 4));
#else
Expand Down
Loading

0 comments on commit 5d80bea

Please sign in to comment.