Skip to content

Commit d2dfd84

Browse files
authored
Merge branch 'master' into no-new-T
2 parents caea728 + fa4108e commit d2dfd84

File tree

86 files changed

+1564
-387
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+1564
-387
lines changed

.github/workflows/build-frontends.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ jobs:
2121

2222
- uses: actions/setup-dotnet@v4
2323
with:
24-
dotnet-version: '8.0.x'
25-
dotnet-quality: 'ga'
24+
dotnet-version: '10.0.x'
25+
dotnet-quality: 'preview'
2626

2727
- name: Install dependencies
28-
run: dotnet restore ILSpy.XPlat.slnf
28+
run: dotnet restore ILSpy.XPlat.slnf -p:RestoreEnablePackagePruning=false
2929

3030
- name: Build Debug
3131
run: dotnet msbuild ILSpy.XPlat.slnf -p:Configuration=Debug -bl:Debug.binlog

.github/workflows/build-ilspy.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ jobs:
3434

3535
- uses: actions/setup-dotnet@v4
3636
with:
37-
dotnet-version: '8.0.x'
38-
dotnet-quality: 'ga'
37+
dotnet-version: '10.0.x'
38+
dotnet-quality: 'preview'
3939
env:
4040
DOTNET_INSTALL_DIR: ${{ runner.temp }}/.dotnet
4141
DOTNET_ROOT: ${{ runner.temp }}/.dotnet
@@ -44,7 +44,7 @@ jobs:
4444
uses: microsoft/setup-msbuild@v2
4545

4646
- name: Install dotnet-format
47-
run: dotnet tool install -g dotnet-format --version "8.3.546805" --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json
47+
run: dotnet tool install -g dotnet-format --version "9.0.520307" --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json
4848

4949
- name: Install wix (locked version)
5050
run: dotnet tool install --global wix --version 6.0.0
@@ -57,17 +57,17 @@ jobs:
5757
Get-ChildItem Env: | Where-Object {$_.Name -Match "^ILSPY_"} | %{ echo "$($_.Name)=$($_.Value)" } | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append
5858
5959
- name: Restore the application
60-
run: msbuild ILSpy.sln /t:Restore /p:Configuration=${{ matrix.configuration }} /p:Platform=$env:BuildPlatform
60+
run: msbuild ILSpy.sln /t:Restore /p:RestoreEnablePackagePruning=false /p:Configuration=${{ matrix.configuration }} /p:Platform=$env:BuildPlatform
6161

6262
- name: Build
6363
run: msbuild ILSpy.sln /p:Configuration=${{ matrix.configuration }} /p:Platform=$env:BuildPlatform /m
6464

6565
- name: Execute unit tests
6666
run: dotnet test --logger "trx;LogFileName=${{ matrix.configuration }}.trx" --results-directory test-results $env:Tests1 $env:Tests2 $env:Tests3
6767
env:
68-
Tests1: ICSharpCode.Decompiler.Tests\bin\${{ matrix.configuration }}\net8.0-windows\win-x64\ICSharpCode.Decompiler.Tests.dll
69-
Tests2: ILSpy.Tests\bin\${{ matrix.configuration }}\net8.0-windows\ILSpy.Tests.dll
70-
Tests3: ILSpy.BamlDecompiler.Tests\bin\${{ matrix.configuration }}\net8.0-windows\win-x64\ILSpy.BamlDecompiler.Tests.dll
68+
Tests1: ICSharpCode.Decompiler.Tests\bin\${{ matrix.configuration }}\net10.0-windows\win-x64\ICSharpCode.Decompiler.Tests.dll
69+
Tests2: ILSpy.Tests\bin\${{ matrix.configuration }}\net10.0-windows\ILSpy.Tests.dll
70+
Tests3: ILSpy.BamlDecompiler.Tests\bin\${{ matrix.configuration }}\net10.0-windows\win-x64\ILSpy.BamlDecompiler.Tests.dll
7171

7272
- name: Upload Test Logs
7373
uses: actions/upload-artifact@v4
@@ -94,19 +94,19 @@ jobs:
9494
git diff --exit-code
9595
9696
- name: Zip ILSpy (framework-dependent)
97-
run: 7z a -tzip $env:StagingDirectory\ILSpy_binaries.zip .\ILSpy\bin\${{ matrix.configuration }}\net8.0-windows\*.dll .\ILSpy\bin\${{ matrix.configuration }}\net8.0-windows\*.exe .\ILSpy\bin\${{ matrix.configuration }}\net8.0-windows\*.config .\ILSpy\bin\${{ matrix.configuration }}\net8.0-windows\*.json .\ILSpy\bin\${{ matrix.configuration }}\net8.0-windows\*\ILSpy.resources.dll .\ILSpy\bin\${{ matrix.configuration }}\net8.0-windows\*\ILSpy.ReadyToRun.Plugin.resources.dll
97+
run: 7z a -tzip $env:StagingDirectory\ILSpy_binaries.zip .\ILSpy\bin\${{ matrix.configuration }}\net10.0-windows\*.dll .\ILSpy\bin\${{ matrix.configuration }}\net10.0-windows\*.exe .\ILSpy\bin\${{ matrix.configuration }}\net10.0-windows\*.config .\ILSpy\bin\${{ matrix.configuration }}\net10.0-windows\*.json .\ILSpy\bin\${{ matrix.configuration }}\net10.0-windows\*\ILSpy.resources.dll .\ILSpy\bin\${{ matrix.configuration }}\net10.0-windows\*\ILSpy.ReadyToRun.Plugin.resources.dll
9898

9999
- name: Publish x64/arm64 framework-dependent/self-contained
100100
shell: pwsh
101101
run: .\publish.ps1
102102

103103
- name: Zip ILSpy Release (x64 self-contained)
104104
if: matrix.configuration == 'release'
105-
run: 7z a -tzip $env:StagingDirectory\ILSpy_selfcontained_x64.zip .\ILSpy\bin\Release\net8.0-windows\win-x64\publish\selfcontained\*
105+
run: 7z a -tzip $env:StagingDirectory\ILSpy_selfcontained_x64.zip .\ILSpy\bin\Release\net10.0-windows\win-x64\publish\selfcontained\*
106106

107107
- name: Zip ILSpy Release (arm64 framework-dependent)
108108
if: matrix.configuration == 'release'
109-
run: 7z a -tzip $env:StagingDirectory\ILSpy_binaries_arm64.zip .\ILSpy\bin\Release\net8.0-windows\win-arm64\publish\fwdependent\*
109+
run: 7z a -tzip $env:StagingDirectory\ILSpy_binaries_arm64.zip .\ILSpy\bin\Release\net10.0-windows\win-arm64\publish\fwdependent\*
110110

111111
- name: Pack NuGets
112112
if: matrix.configuration == 'release'

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ jobs:
3737

3838
- uses: actions/setup-dotnet@v4
3939
with:
40-
dotnet-version: '8.0.x'
41-
dotnet-quality: 'ga'
40+
dotnet-version: '10.0.x'
41+
dotnet-quality: 'preview'
4242

4343
- name: Build
44-
run: dotnet build ILSpy.XPlat.slnf --configuration Release
44+
run: dotnet build ILSpy.XPlat.slnf --configuration Release -p:RestoreEnablePackagePruning=false
4545

4646
- name: Perform CodeQL Analysis
4747
uses: github/codeql-action/analyze@v3

.gitmodules

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[submodule "ILSpy-tests"]
22
path = ILSpy-tests
33
url = https://github.com/icsharpcode/ILSpy-tests
4+
branch = master

BuildTools/pre-commit

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
set -eu
77

8-
DOTNET_FORMAT_VERSION=8.3.546805
8+
DOTNET_FORMAT_VERSION=9.0.520307
99
DOTNET_PATH="$LOCALAPPDATA/ICSharpCode/ILSpy/dotnet-format-$DOTNET_FORMAT_VERSION"
1010
if [ ! -d "$DOTNET_PATH" ]; then
1111
echo "Downloading dotnet-format $DOTNET_FORMAT_VERSION..."
12-
dotnet tool install --tool-path "$DOTNET_PATH" dotnet-format --version "$DOTNET_FORMAT_VERSION" --add-source "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json"
12+
dotnet tool install --tool-path "$DOTNET_PATH" dotnet-format --version "$DOTNET_FORMAT_VERSION" --add-source "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json"
1313
fi
1414

1515
"$DOTNET_PATH/dotnet-format.exe" --version

Directory.Packages.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<PackageVersion Include="DataGridExtensions" Version="2.6.0" />
1010
<PackageVersion Include="DiffLib" Version="2025.0.0" />
1111
<PackageVersion Include="Dirkster.AvalonDock.Themes.VS2013" Version="4.72.1" />
12-
<PackageVersion Include="ILCompiler.Reflection.ReadyToRun.Experimental" Version="9.0.1-rtm.24557.9" />
12+
<PackageVersion Include="ILCompiler.Reflection.ReadyToRun.Experimental" Version="10.0.0-preview.4.25213.101" />
1313
<PackageVersion Include="Iced" Version="1.21.0" />
1414
<PackageVersion Include="JunitXml.TestLogger" Version="6.1.0" />
1515
<PackageVersion Include="K4os.Compression.LZ4" Version="1.3.8" />
@@ -40,9 +40,9 @@
4040
<PackageVersion Include="PowerShellStandard.Library" Version="5.1.1" />
4141
<PackageVersion Include="Shouldly" Version="4.3.0" />
4242
<PackageVersion Include="System.Composition.AttributedModel" Version="9.0.4" />
43-
<PackageVersion Include="System.Collections.Immutable" Version="9.0.4" />
43+
<PackageVersion Include="System.Collections.Immutable" Version="10.0.0-preview.3.25171.5" />
4444
<PackageVersion Include="System.Memory" Version="4.6.3" />
45-
<PackageVersion Include="System.Reflection.Metadata" Version="9.0.4" />
45+
<PackageVersion Include="System.Reflection.Metadata" Version="10.0.0-preview.3.25171.5" />
4646
<PackageVersion Include="System.Resources.Extensions" Version="9.0.4" />
4747
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.1.2" />
4848
<PackageVersion Include="TomsToolbox.Composition.MicrosoftExtensions" Version="2.22.0" />

ICSharpCode.BamlDecompiler/ICSharpCode.BamlDecompiler.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55

66
<SignAssembly>True</SignAssembly>
77
<AssemblyOriginatorKeyFile>..\ICSharpCode.Decompiler\ICSharpCode.Decompiler.snk</AssemblyOriginatorKeyFile>
@@ -14,7 +14,7 @@
1414

1515
<PropertyGroup>
1616
<PackageId>ICSharpCode.BamlDecompiler</PackageId>
17-
<PackageVersion>8.0.0.0-noversion</PackageVersion>
17+
<PackageVersion>10.0.0.0-noversion</PackageVersion>
1818
<Title>ILSpy BAML Decompiler</Title>
1919
<Authors>ILSpy Contributors</Authors>
2020
<PackageLicenseExpression>MIT</PackageLicenseExpression>
@@ -44,7 +44,7 @@
4444
<!-- https://devblogs.microsoft.com/nuget/enable-repeatable-package-restores-using-a-lock-file/ -->
4545
<PropertyGroup>
4646
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
47-
<RestoreLockedMode Condition="'$(GITHUB_ACTIONS)' == 'true'">true</RestoreLockedMode>
47+
<RestoreLockedMode>true</RestoreLockedMode>
4848
</PropertyGroup>
4949

5050
<ItemGroup>

ICSharpCode.BamlDecompiler/packages.lock.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"version": 2,
33
"dependencies": {
4-
"net8.0": {
4+
"net10.0": {
55
"Microsoft.Sbom.Targets": {
66
"type": "Direct",
77
"requested": "[3.1.0, )",
@@ -23,7 +23,7 @@
2323
},
2424
"System.Collections.Immutable": {
2525
"type": "CentralTransitive",
26-
"requested": "[9.0.4, )",
26+
"requested": "[10.0.0-preview.3.25171.5, )",
2727
"resolved": "6.0.0",
2828
"contentHash": "l4zZJ1WU2hqpQQHXz1rvC3etVZN+2DLmQMO79FhOTZHMn8tDRr+WU287sbomD0BETlmKDn0ygUgVy9k5xkkJdA==",
2929
"dependencies": {
@@ -32,7 +32,7 @@
3232
},
3333
"System.Reflection.Metadata": {
3434
"type": "CentralTransitive",
35-
"requested": "[9.0.4, )",
35+
"requested": "[10.0.0-preview.3.25171.5, )",
3636
"resolved": "6.0.0",
3737
"contentHash": "sffDOcex1C3HO5kDolOYcWXTwRpZY/LvJujM6SMjn63fWMJWchYAAmkoAJXlbpZ5yf4d+KMgxd+LeETa4gD9sQ==",
3838
"dependencies": {

ICSharpCode.Decompiler.TestRunner/ICSharpCode.Decompiler.TestRunner.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFramework>net10.0</TargetFramework>
66
<Nullable>enable</Nullable>
77
</PropertyGroup>
88

ICSharpCode.Decompiler.Tests/Helpers/RoslynToolset.cs

Lines changed: 81 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,22 @@
1818

1919
using System;
2020
using System.Collections.Generic;
21+
using System.Diagnostics;
2122
using System.IO;
2223
using System.Linq;
2324
using System.Threading;
2425
using System.Threading.Tasks;
2526

26-
using ICSharpCode.Decompiler.Util;
27+
using ICSharpCode.Decompiler.Metadata;
2728

2829
using NuGet.Common;
2930
using NuGet.Packaging;
3031
using NuGet.Protocol;
3132
using NuGet.Protocol.Core.Types;
3233
using NuGet.Versioning;
3334

35+
using NUnit.Framework;
36+
3437
namespace ICSharpCode.Decompiler.Tests.Helpers
3538
{
3639
abstract class AbstractToolset
@@ -50,29 +53,45 @@ public AbstractToolset(string baseDir)
5053

5154
protected async Task FetchPackage(string packageName, string version, string sourcePath, string outputPath)
5255
{
56+
if (!Directory.Exists(Path.Combine(Roundtrip.RoundtripAssembly.TestDir, "nuget")))
57+
Assert.Fail("No nuget cache found!");
58+
5359
ILogger logger = NullLogger.Instance;
5460
CancellationToken cancellationToken = CancellationToken.None;
55-
using MemoryStream packageStream = new MemoryStream();
56-
57-
await resource.CopyNupkgToStreamAsync(
58-
packageName,
59-
NuGetVersion.Parse(version),
60-
packageStream,
61-
cache,
62-
logger,
63-
cancellationToken).ConfigureAwait(false);
64-
65-
using PackageArchiveReader packageReader = new PackageArchiveReader(packageStream);
66-
NuspecReader nuspecReader = await packageReader.GetNuspecReaderAsync(cancellationToken).ConfigureAwait(false);
67-
68-
var files = (await packageReader.GetFilesAsync(cancellationToken).ConfigureAwait(false)).ToArray();
69-
files = files.Where(f => f.StartsWith(sourcePath, StringComparison.OrdinalIgnoreCase)).ToArray();
70-
await packageReader.CopyFilesAsync(outputPath, files,
71-
(sourceFile, targetPath, fileStream) => {
72-
fileStream.CopyToFile(targetPath);
73-
return targetPath;
74-
},
75-
logger, cancellationToken).ConfigureAwait(false);
61+
string pathToPackage = Path.Combine(Roundtrip.RoundtripAssembly.TestDir, "nuget", $"{packageName}-{version}.nupkg");
62+
Stream packageStream;
63+
if (File.Exists(pathToPackage))
64+
{
65+
packageStream = File.OpenRead(pathToPackage);
66+
}
67+
else
68+
{
69+
packageStream = new MemoryStream();
70+
71+
await resource.CopyNupkgToStreamAsync(
72+
packageName,
73+
NuGetVersion.Parse(version),
74+
packageStream,
75+
cache,
76+
logger,
77+
cancellationToken).ConfigureAwait(false);
78+
79+
packageStream.Position = 0;
80+
}
81+
using (packageStream)
82+
{
83+
using PackageArchiveReader packageReader = new PackageArchiveReader(packageStream);
84+
NuspecReader nuspecReader = await packageReader.GetNuspecReaderAsync(cancellationToken).ConfigureAwait(false);
85+
86+
var files = (await packageReader.GetFilesAsync(cancellationToken).ConfigureAwait(false)).ToArray();
87+
files = files.Where(f => f.StartsWith(sourcePath, StringComparison.OrdinalIgnoreCase)).ToArray();
88+
await packageReader.CopyFilesAsync(outputPath, files,
89+
(sourceFile, targetPath, fileStream) => {
90+
fileStream.CopyToFile(targetPath);
91+
return targetPath;
92+
},
93+
logger, cancellationToken).ConfigureAwait(false);
94+
}
7695
}
7796
}
7897

@@ -145,4 +164,44 @@ public async Task Fetch()
145164

146165
public string GetVsWhere() => vswherePath;
147166
}
167+
168+
class RefAssembliesToolset : AbstractToolset
169+
{
170+
readonly Dictionary<string, string> installedFrameworks = new Dictionary<string, string> {
171+
{ "legacy", Path.Combine(Roundtrip.RoundtripAssembly.TestDir, "dotnet", "legacy") },
172+
{ "2.2.0", Path.Combine(Roundtrip.RoundtripAssembly.TestDir, "dotnet", "netcore-2.2") },
173+
};
174+
175+
public RefAssembliesToolset()
176+
: base(Path.Combine(AppContext.BaseDirectory, "netfx"))
177+
{
178+
}
179+
180+
public async Task Fetch(string version, string packageName = "Microsoft.NETCore.App.Ref", string sourcePath = "ref/net5.0")
181+
{
182+
string path = Path.Combine(baseDir, version, sourcePath);
183+
if (!Directory.Exists(path))
184+
{
185+
await FetchPackage(packageName, version, sourcePath, Path.Combine(baseDir, version)).ConfigureAwait(false);
186+
}
187+
188+
installedFrameworks.Add(RoslynToolset.SanitizeVersion(version), path);
189+
}
190+
191+
internal string GetPath(string targetFramework)
192+
{
193+
var (id, version) = UniversalAssemblyResolver.ParseTargetFramework(targetFramework);
194+
string path;
195+
if (id == TargetFrameworkIdentifier.NETFramework)
196+
{
197+
path = installedFrameworks["legacy"];
198+
}
199+
else
200+
{
201+
path = installedFrameworks[version.ToString(3)];
202+
}
203+
Debug.Assert(Path.Exists(path));
204+
return path;
205+
}
206+
}
148207
}

0 commit comments

Comments
 (0)