Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,10 @@
]
},
"dotnet-ilverify": {
"version": "8.0.0",
"version": "10.0.11",
"commands": [
"ilverify"
]
},
"microsoft.coyote.cli": {
"version": "1.7.11",
"commands": [
"coyote"
]
}
}
}
4 changes: 4 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ jobs:
uses: NuGet/setup-nuget@v1
with:
nuget-version: '6.x'
- name: Setup .NET 10.0 SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: '10.0.x'
- name: Setup .NET 8.0 SDK
uses: actions/setup-dotnet@v1
with:
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/test-coyote.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ jobs:
uses: NuGet/setup-nuget@v1
with:
nuget-version: '6.x'
- name: Setup .NET 10.0 SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: '10.0.303'
- name: Setup .NET 8.0 SDK
uses: actions/setup-dotnet@v1
with:
Expand All @@ -48,9 +52,14 @@ jobs:
- name: Build Coyote projects
run: ./Scripts/build.ps1 -ci -nuget
shell: pwsh
- name: Run native host compatibility matrix
run: ./Tests/Compatibility/run-compatibility-matrix.ps1
shell: pwsh
- name: Validate Coyote rewriting
if: ${{ matrix.platform == 'windows-latest' }}
run: ./Tests/compare-rewriting-diff-logs.ps1
run: |
./Tests/compare-rewriting-diff-logs.ps1 -framework net10.0
./Tests/compare-rewriting-diff-logs.ps1 -framework net8.0
shell: pwsh
- name: Run Coyote tests
run: ./Scripts/run-tests.ps1 -ci
Expand Down Expand Up @@ -83,6 +92,10 @@ jobs:
COYOTE_CLI_TELEMETRY_OPTOUT: 1
steps:
- uses: actions/checkout@v2
- name: Setup .NET 10.0 SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: '10.0.303'
- name: Setup .NET 8.0 SDK
uses: actions/setup-dotnet@v1
with:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test-performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ jobs:
uses: NuGet/setup-nuget@v1
with:
nuget-version: '6.x'
- name: Setup .NET 10.0 SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: '10.0.x'
- name: Setup .NET 8.0 SDK
uses: actions/setup-dotnet@v1
with:
Expand Down
7 changes: 5 additions & 2 deletions Common/build.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageOutputPath>$(MSBuildThisFileDirectory)/../bin/nuget</PackageOutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net10.0'">
<LangVersion>14.0</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0' or '$(TargetFramework)' == 'net6.0'">
<LangVersion>10.0</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' != 'net8.0' and '$(TargetFramework)' != 'net6.0'">
<PropertyGroup Condition="'$(TargetFramework)' != 'net10.0' and '$(TargetFramework)' != 'net8.0' and '$(TargetFramework)' != 'net6.0'">
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<PropertyGroup>
Expand All @@ -44,7 +47,7 @@
<Net6Installed>false</Net6Installed>
<Net6Installed Condition="$(GlobalVersion.StartsWith('6.0'))">true</Net6Installed>
<Net6Installed Condition="'$(BUILD_NET6)'=='yes'">true</Net6Installed>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net10.0;net8.0</TargetFrameworks>
<TargetFrameworks Condition="'$(NetStandard2Supported)'">$(TargetFrameworks);netstandard2.0</TargetFrameworks>
<TargetFrameworks Condition="'$(Net6Installed)' and '$(Net6Supported)'">$(TargetFrameworks);net6.0</TargetFrameworks>
</PropertyGroup>
Expand Down
324 changes: 324 additions & 0 deletions NET10-COMPATIBILITY-ASSESSMENT.md

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions Samples/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"microsoft.coyote.cli": {
"version": "1.7.11",
"commands": [
"coyote"
]
}
}
}
2 changes: 1 addition & 1 deletion Samples/Scripts/build-tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Write-Comment -prefix "." -text "Building the Coyote samples" -color "yellow"

if ($local.IsPresent -and $nuget.IsPresent) {
# Restore the local coyote tool.
&dotnet tool restore
&dotnet tool restore --tool-manifest "$PSScriptRoot/../.config/dotnet-tools.json"
}

# Check that the expected .NET SDK is installed.
Expand Down
2 changes: 1 addition & 1 deletion Samples/Scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Write-Comment -prefix "." -text "Building the Coyote samples" -color "yellow"

if ($local.IsPresent -and $nuget.IsPresent) {
# Restore the local coyote tool.
&dotnet tool restore
&dotnet tool restore --tool-manifest "$PSScriptRoot/../.config/dotnet-tools.json"
}

# Check that the expected .NET SDK is installed.
Expand Down
35 changes: 35 additions & 0 deletions Scripts/CI/azure-nuget-sign-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ steps:
inputs:
versionSpec: 6.x

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

- task: UseDotNet@2
displayName: 'Install .NET 8.0 SDK'
inputs:
Expand All @@ -33,6 +38,36 @@ steps:
failOnStderr: true
pwsh: true

- task: EsrpCodeSigning@2
displayName: 'ESRP CodeSigning .NET 10.0'
inputs:
ConnectedServiceName: CoyoteNugetSign
FolderPath: bin\net10.0
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 8.0'
inputs:
Expand Down
2 changes: 1 addition & 1 deletion Scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ if ($ci.IsPresent) {

Write-Comment -text "Using configuration '$configuration'." -color "magenta"
$solution = Join-Path -Path $ScriptDir -ChildPath ".." -AdditionalChildPath "Coyote.sln"
$command = "build -c $configuration /p:Platform=""Any CPU"" $extra_frameworks $solution"
$command = "build -m:1 -c $configuration /p:Platform=""Any CPU"" $extra_frameworks $solution"

$error_msg = "Failed to build Coyote"
Invoke-ToolCommand -tool $dotnet -cmd $command -error_msg $error_msg
Expand Down
16 changes: 10 additions & 6 deletions Scripts/common.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ function Invoke-CoyoteTool([String]$cmd, [String]$dotnet, [String]$framework, [S
$command = "$coyote $cmd $target"
}

if ($command -eq "rewrite" -and $framework -ne "net6.0" -and $framework -ne "net8.0" -and $IsWindows) {
if ($cmd -eq "rewrite" -and $framework -ne "net10.0" -and $framework -ne "net8.0" -and
$framework -ne "net6.0" -and $IsWindows) {
# NOTE: Mono.Cecil cannot sign assemblies on unix platforms.
$command = "$command -snk $key"
}
Expand Down Expand Up @@ -156,11 +157,14 @@ function FindDotNetSdkVersion([String]$dotnet_sdk_path) {
}

# Finds the dotnet runtime version.
function FindDotNetRuntimeVersion([String]$dotnet_runtime_path) {
$globalJson = Join-Path -Path $PSScriptRoot -ChildPath ".." -AdditionalChildPath @("global.json")
$json = Get-Content $globalJson | Out-String | ConvertFrom-Json
$global_version = $json.sdk.version
return FindMatchingVersion -path $dotnet_runtime_path -version $global_version
function FindDotNetRuntimeVersion([String]$dotnet_runtime_path, [version]$version) {
if ($null -eq $version) {
$globalJson = Join-Path -Path $PSScriptRoot -ChildPath ".." -AdditionalChildPath @("global.json")
$json = Get-Content $globalJson | Out-String | ConvertFrom-Json
$version = $json.sdk.version
}

return FindMatchingVersion -path $dotnet_runtime_path -version $version
}

# Searches the specified directory for the closest match for the given version.
Expand Down
2 changes: 1 addition & 1 deletion Scripts/gen-docs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

$root_dir = "$PSScriptRoot\.."
$packages_path = "$root_dir\packages"
$framework = "net8.0"
$framework = "net10.0"

Import-Module $PSScriptRoot\common.psm1 -Force

Expand Down
2 changes: 1 addition & 1 deletion Scripts/run-benchmark-history.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function RestoreBenchmark() {
Invoke-Expression "sed -i 's/\\Performance.Tests.csproj/\\Microsoft.Coyote.Performance.Tests.csproj/' $RootDir\Coyote.sln"
}

$benchmarks_dir = "$RootDir/Tools/BenchmarkRunner/bin/net8.0"
$benchmarks_dir = "$RootDir/Tools/BenchmarkRunner/bin/net10.0"
$benchmark_runner = "BenchmarkRunner.exe"
$index = 0

Expand Down
2 changes: 1 addition & 1 deletion Scripts/run-benchmarks.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ if ($local -eq ""){
}

$current_dir = (Get-Item -Path "./").FullName
$benchmarks_dir = "$PSScriptRoot/../Tools/BenchmarkRunner/bin/net8.0"
$benchmarks_dir = "$PSScriptRoot/../Tools/BenchmarkRunner/bin/net10.0"
$benchmark_runner = "BenchmarkRunner.exe"
$artifacts_dir = "$current_dir/benchmark_$commit"

Expand Down
24 changes: 14 additions & 10 deletions Scripts/run-tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# Licensed under the MIT License.

param(
[ValidateSet("net8.0", "net6.0", "net462")]
[string]$framework = "net8.0",
[ValidateSet("net10.0", "net8.0", "net6.0", "net462")]
[string]$framework = "net10.0",
[ValidateSet("all", "runtime", "rewriting", "testing", "actors", "actors-testing", "tools")]
[string]$test = "all",
[string]$filter = "",
Expand All @@ -30,17 +30,14 @@ $targets = [ordered]@{
$dotnet = "dotnet"
$dotnet_runtime_path = FindDotNetRuntimePath -dotnet $dotnet -runtime "NETCore"
$aspnet_runtime_path = FindDotNetRuntimePath -dotnet $dotnet -runtime "AspNetCore"
$runtime_version = FindDotNetRuntimeVersion -dotnet_runtime_path $dotnet_runtime_path

# NOTE: we do some hacks to get around a known issue with dotnet tool
# command being available after locally being restored.
# Example: https://github.com/dotnet/sdk/issues/11820
# Restore the local ilverify tool.
&dotnet nuget locals all --clear
&dotnet tool restore
&dotnet tool install dotnet-ilverify --version 8.0.0
&dotnet tool list
$ilverify = "dotnet ilverify"
$ilverify = "dotnet tool run ilverify"

[System.Environment]::SetEnvironmentVariable('COYOTE_CLI_TELEMETRY_OPTOUT', '1')

Expand All @@ -59,14 +56,21 @@ foreach ($kvp in $targets.GetEnumerator()) {
}

$target = "$PSScriptRoot/../Tests/$($kvp.Value)/$($kvp.Value).csproj"
if ($f -eq "net8.0") {
if ($f -eq "net10.0" -or $f -eq "net8.0") {
$runtime_version = FindDotNetRuntimeVersion -dotnet_runtime_path $dotnet_runtime_path `
-version $f.Substring(3)
$AssemblyName = GetAssemblyName($target)
$command = [IO.Path]::Combine($PSScriptRoot, "..", "Tests", $($kvp.Value), "bin", "net8.0", "$AssemblyName.dll")
$command = [IO.Path]::Combine($PSScriptRoot, "..", "Tests", $($kvp.Value), "bin", $f, "$AssemblyName.dll")
$command = $command + ' -r "' + [IO.Path]::Combine( `
$PSScriptRoot, "..", "Tests", $($kvp.Value), "bin", "net8.0", "*.dll") + '"'
$command = $command + ' -r "' + [IO.Path]::Combine($PSScriptRoot, "..", "bin", "net8.0", "*.dll") + '"'
$PSScriptRoot, "..", "Tests", $($kvp.Value), "bin", $f, "*.dll") + '"'
$command = $command + ' -r "' + [IO.Path]::Combine($PSScriptRoot, "..", "bin", $f, "*.dll") + '"'
$command = $command + ' -r "' + [IO.Path]::Combine($dotnet_runtime_path, $runtime_version, "*.dll") + '"'
$command = $command + ' -r "' + [IO.Path]::Combine($aspnet_runtime_path, $runtime_version, "*.dll") + '"'
if ($f -eq "net10.0") {
# ILVerify rejects the SDK-generated inline-array span helper even before rewriting.
$command = $command + ' -e ".*InlineArrayAsReadOnlySpan.*"'
}

Invoke-ToolCommand -tool $ilverify -cmd $command -error_msg "found corrupted assembly rewriting"
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</PropertyGroup>
<Import Project="..\..\Common\build.props" />
<Import Project="..\..\Common\key.props" />
<ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'net462'">
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
</ItemGroup>
</Project>
6 changes: 6 additions & 0 deletions Source/Test/Rewriting/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.IO;
using System.Linq;
using System.Reflection;
using Microsoft.Coyote.Runtime;
using Mono.Cecil;
using Mono.Cecil.Cil;

Expand Down Expand Up @@ -280,6 +281,11 @@ private CustomAttribute GetCustomAttribute(Type attributeType) =>
/// </summary>
private void ValidateAssembly()
{
// Rewriting resolves the replacement types of the running Coyote host, so the host and
// the assembly must target the same .NET major version. This also covers any dependency
// that was loaded transitively, as such a dependency is rewritten as well.
TargetRuntimeValidator.ValidateRewritingTarget(this.FilePath, this.Definition);

if (this.IsAssemblyRewritten(out string version, out string signatureHash))
{
// The assembly has been already rewritten so check if the signatures match.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ internal TypeRewritingPass(RewritingOptions options, IEnumerable<AssemblyInfo> v
this.KnownTypes[NameCache.ManualResetEvent] = typeof(Types.Threading.ManualResetEvent);
this.KnownTypes[NameCache.EventWaitHandle] = typeof(Types.Threading.EventWaitHandle);
this.KnownTypes[NameCache.WaitHandle] = typeof(Types.Threading.WaitHandle);
#if NET10_0_OR_GREATER
this.KnownTypes[NameCache.Lock] = typeof(Types.Threading.Lock);
this.KnownTypes[NameCache.LockScope] = typeof(Types.Threading.Lock.Scope);
#endif

#if NET
// Populate the map with the known HTTP and web-related types.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ member.Name is nameof(System.Threading.EventWaitHandle.TryOpenExisting)))
return true;
}
else if (type.Name is nameof(System.Threading.ExecutionContext) ||
type.Name is nameof(System.Threading.Barrier) ||
type.Name is nameof(System.Threading.CountdownEvent) ||
type.Name is nameof(System.Threading.ManualResetEventSlim) ||
type.Name is nameof(System.Threading.Mutex) ||
type.Name is nameof(System.Threading.ReaderWriterLock) ||
Expand Down
8 changes: 8 additions & 0 deletions Source/Test/Rewriting/RewritingEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ internal static void Run(RewritingOptions options, Configuration configuration,
/// </summary>
private void Run()
{
// Validate that the runtime of the Coyote host is compatible with each requested target
// assembly before creating or modifying any output. Rewriting an assembly that targets a
// different .NET major version injects runtime references that the assembly cannot load.
foreach (string assemblyPath in this.Options.AssemblyPaths)
{
TargetRuntimeValidator.ValidateRewritingTarget(assemblyPath);
}

this.Profiler.StartMeasuringExecutionTime();

// Create the output directory and copy any necessary files.
Expand Down
3 changes: 2 additions & 1 deletion Source/Test/Rewriting/RewritingOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@ private static bool TryResolveTargetFramework(Assembly assembly, out string reso
{
if (tokens[0] == ".NETCoreApp")
{
resolvedTargetFramework = tokens[1] is "v8.0" ? "net8.0" :
resolvedTargetFramework = tokens[1] is "v10.0" ? "net10.0" :
tokens[1] is "v8.0" ? "net8.0" :
tokens[1] is "v6.0" ? "net6.0" :
resolvedTargetFramework;
}
Expand Down
4 changes: 4 additions & 0 deletions Source/Test/Rewriting/Types/NameCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ internal static class NameCache
internal static string ManualResetEvent { get; } = typeof(SystemThreading.ManualResetEvent).FullName;
internal static string EventWaitHandle { get; } = typeof(SystemThreading.EventWaitHandle).FullName;
internal static string WaitHandle { get; } = typeof(SystemThreading.WaitHandle).FullName;
#if NET10_0_OR_GREATER
internal static string Lock { get; } = typeof(SystemThreading.Lock).FullName;
internal static string LockScope { get; } = typeof(SystemThreading.Lock).FullName + "/Scope";
#endif

internal static string GenericList { get; } = typeof(SystemGenericCollections.List<>).FullName;
internal static string GenericDictionary { get; } = typeof(SystemGenericCollections.Dictionary<,>).FullName;
Expand Down
Loading
Loading