Skip to content
Merged
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
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Set up .NET
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6
with:
dotnet-version: 10.0.x
dotnet-version: 11.0.x

- name: Set up Node 24
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
Expand Down Expand Up @@ -76,10 +76,10 @@ jobs:
- name: Set up .NET
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6
with:
dotnet-version: 10.0.x
dotnet-version: 11.0.x

- name: Restore
run: dotnet restore CHDStudio/CHDStudio.csproj

- name: Build neutral TFM
run: dotnet build CHDStudio/CHDStudio.csproj -c Release -f net10.0 --no-restore
run: dotnet build CHDStudio/CHDStudio.csproj -c Release -f net11.0 --no-restore
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Set up .NET
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6
with:
dotnet-version: 10.0.x
dotnet-version: 11.0.x

- name: Initialize CodeQL
uses: github/codeql-action/init@33d7b85da1a04171e211befe2c739303b9a4c066 # v4
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Artifacts: one release_<version>_<rid>.zip per runtime identifier, for
# Windows (win-x64, win-arm64), Linux (linux-x64, linux-arm64) and macOS
# (osx-x64, osx-arm64). The app is framework-dependent (users install the
# .NET 10 Desktop Runtime on Windows, the .NET 10 runtime on Linux/macOS)
# .NET 11 Desktop Runtime on Windows, the .NET 11 runtime on Linux/macOS)
# and published as a single file; see scripts/ci/package-release.ps1.
name: Release

Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:
- name: Set up .NET
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6
with:
dotnet-version: 10.0.x
dotnet-version: 11.0.x

- name: Restore
run: dotnet restore CSharp_CHDStudio.sln
Expand All @@ -102,17 +102,17 @@ jobs:
matrix:
include:
- rid: win-x64
tfm: net10.0-windows
tfm: net11.0-windows
- rid: win-arm64
tfm: net10.0-windows
tfm: net11.0-windows
- rid: linux-x64
tfm: net10.0
tfm: net11.0
- rid: linux-arm64
tfm: net10.0
tfm: net11.0
- rid: osx-x64
tfm: net10.0
tfm: net11.0
- rid: osx-arm64
tfm: net10.0
tfm: net11.0
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
Expand All @@ -122,7 +122,7 @@ jobs:
- name: Set up .NET
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6
with:
dotnet-version: 10.0.x
dotnet-version: 11.0.x

- name: Publish single-file (framework-dependent)
run: >
Expand Down
61 changes: 37 additions & 24 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ project.
### The application project

- `CHDStudio` is the base app project: it multi-targets
`net10.0` (Linux/macOS) and `net10.0-windows` (Windows), builds
`net11.0` (Linux/macOS) and `net11.0-windows` (Windows), builds
`CHDStudio.exe`, and links no files from outside its folder. The
Windows TFM adds NAudio (Media Foundation/ACM MP3 decoding); the neutral TFM
decodes MP3 via `ffmpeg` on PATH.
Expand All @@ -34,9 +34,9 @@ project.

## Toolchain

- .NET SDK 10 - declared in `global.json` (`rollForward: latestMajor`). Never
lower the Windows target below `net10.0-windows`; the Windows UI and NAudio
need it.
- .NET SDK 11 - declared in `global.json` (`rollForward: latestMajor`). C# 15 is
enabled through `LangVersion`. Never lower the Windows target below
`net11.0-windows`; the Windows UI and NAudio need it.
- Node.js 24 - used only for the zero-dependency helper scripts in
`scripts/ci/`. Do not add npm packages or a `package.json`.
- Avalonia 12.1 (desktop, Fluent theme, DataGrid); the neutral TFM must keep
Expand All @@ -55,24 +55,35 @@ dotnet test CHDStudio.Tests/CHDStudio.Tests.csproj -c Release
dotnet test CHDStudio.Tests/CHDStudio.Tests.csproj -c Release --filter "Category!=Integration"

# Framework-dependent single-file publish (one per architecture)
dotnet publish CHDStudio/CHDStudio.csproj -c Release -f net10.0-windows -r win-x64 --self-contained false -p:PublishSingleFile=true -o publish/win-x64
dotnet publish CHDStudio/CHDStudio.csproj -c Release -f net10.0-windows -r win-arm64 --self-contained false -p:PublishSingleFile=true -o publish/win-arm64
dotnet publish CHDStudio/CHDStudio.csproj -c Release -f net11.0-windows -r win-x64 --self-contained false -p:PublishSingleFile=true -o publish/win-x64
dotnet publish CHDStudio/CHDStudio.csproj -c Release -f net11.0-windows -r win-arm64 --self-contained false -p:PublishSingleFile=true -o publish/win-arm64

# Release zip (same command CI runs)
./scripts/ci/package-release.ps1 -Rid win-x64 -Version 3.7.0 -PublishDir publish/win-x64 -OutputDir dist

# Run on Windows (multi-targeted, so pick the Windows TFM)
dotnet run --project CHDStudio/CHDStudio.csproj -f net10.0-windows
dotnet run --project CHDStudio/CHDStudio.csproj -f net11.0-windows

# Framework-dependent single-file publishes for Linux/macOS (neutral TFM)
dotnet publish CHDStudio/CHDStudio.csproj -c Release -f net10.0 -r linux-x64 --self-contained false -p:PublishSingleFile=true -o publish/linux-x64
dotnet publish CHDStudio/CHDStudio.csproj -c Release -f net10.0 -r osx-arm64 --self-contained false -p:PublishSingleFile=true -o publish/osx-arm64
dotnet publish CHDStudio/CHDStudio.csproj -c Release -f net11.0 -r linux-x64 --self-contained false -p:PublishSingleFile=true -o publish/linux-x64
dotnet publish CHDStudio/CHDStudio.csproj -c Release -f net11.0 -r osx-arm64 --self-contained false -p:PublishSingleFile=true -o publish/osx-arm64
```

## Pre-commit checks

**Always run `jb inspectcode` before every commit.** Fix every warning and error
it reports; notes are allowed:

```powershell
jb inspectcode --output=InspectCode.log CSharp_CHDStudio.sln
```

Do not commit while InspectCode reports warnings or errors.

## Release engineering (do not break)

- **The app is framework-dependent. It must NOT embed the .NET runtime.** Users
install the .NET 10 Desktop Runtime on Windows and the .NET 10 runtime on
install the .NET 11 Desktop Runtime on Windows and the .NET 11 runtime on
Linux/macOS. Always publish with
`--self-contained false -p:PublishSingleFile=true`. The output is a single
`CHDStudio.exe` (Windows) or `CHDStudio` (Linux/macOS) plus the platform's
Expand All @@ -85,7 +96,9 @@ dotnet publish CHDStudio/CHDStudio.csproj -c Release -f net10.0 -r osx-arm64 --s
library `.xml` IntelliSense files and the native `.pdb` debug symbols (never
used at runtime), and adds `LICENSE.txt`, `ReadMe.md` and `WhatsNew.md`. Do
not put both architectures in one zip. CHD creation works without any bundled
tool thanks to the built-in CHDSharp encoder.
tool thanks to the built-in CHDSharp encoder. Every bundled-tool item keeps
`ExcludeFromSingleFile=true`; without it the .NET 11 single-file publish drops
`7za`/`chdman`/`7zz` from the output and the release zip fails verification.
- **Zip naming is fixed:** `release_<version>_<rid>.zip`, e.g.
`release_3.9.0_win-x64.zip`. One zip per runtime identifier - `win-x64`,
`win-arm64`, `linux-x64`, `linux-arm64`, `osx-x64` and `osx-arm64` - and all
Expand Down Expand Up @@ -120,7 +133,7 @@ dotnet publish CHDStudio/CHDStudio.csproj -c Release -f net10.0 -r osx-arm64 --s
dotnet build CSharp_CHDStudio.sln -c Release
dotnet test CHDStudio.Tests/CHDStudio.Tests.csproj -c Release
node scripts/ci/version.mjs
jb inspectcode CSharp_CHDStudio.sln -o=InspectCode.log
jb inspectcode --output=InspectCode.log CSharp_CHDStudio.sln
```
InspectCode must report zero warnings and zero errors before tagging.
4. **Publish all six framework-dependent single-file bundles**, never
Expand All @@ -130,12 +143,12 @@ dotnet publish CHDStudio/CHDStudio.csproj -c Release -f net10.0 -r osx-arm64 --s
$ErrorActionPreference = 'Stop'
$version = "3.11.0"
$rids = [ordered]@{
'win-x64' = 'net10.0-windows'
'win-arm64' = 'net10.0-windows'
'linux-x64' = 'net10.0'
'linux-arm64' = 'net10.0'
'osx-x64' = 'net10.0'
'osx-arm64' = 'net10.0'
'win-x64' = 'net11.0-windows'
'win-arm64' = 'net11.0-windows'
'linux-x64' = 'net11.0'
'linux-arm64' = 'net11.0'
'osx-x64' = 'net11.0'
'osx-arm64' = 'net11.0'
}
$outRoot = "dist/$version"
New-Item -ItemType Directory -Force -Path $outRoot | Out-Null
Expand Down Expand Up @@ -224,8 +237,8 @@ dotnet publish CHDStudio/CHDStudio.csproj -c Release -f net10.0 -r osx-arm64 --s
- `docs/` is the only documentation source. Keep the Pages front matter and the
wiki `_Sidebar.md` in sync; never edit the wiki UI.
- `CHDStudio/bin/Release/` is append-only. Copy in, never delete.
- Run `jb inspectcode` before tagging; the release gate is zero warnings and
zero errors (notes are allowed).
- Run `jb inspectcode` before every commit and before tagging; the gate is zero
warnings and zero errors (notes are allowed).
- Run the full test suite before tagging; CI runs the unit filter only.


Expand All @@ -245,8 +258,8 @@ workflows, and never commit or echo the API key. It is read from the
`MDSSharp/MDSSharp.csproj` and `ISZSharp/ISZSharp.csproj`): bump
`<Version>`, `<AssemblyVersion>` and `<FileVersion>` together. A pushed
version is immutable - to change anything, bump and push again.
- **Target frameworks** are `net8.0;net9.0;net10.0` so both packages serve
.NET 8, 9 and 10 consumers. `GenerateDocumentationFile` must stay on so each
- **Target frameworks** are `net8.0;net9.0;net10.0;net11.0` so the packages serve
.NET 8, 9, 10 and 11 consumers. `GenerateDocumentationFile` must stay on so each
TFM ships its `.xml` next to the assembly.
- **Metadata** must keep `PackageProjectUrl` and `RepositoryUrl` pointed at
<https://github.com/purelogiccode/CHDStudio>.
Expand Down Expand Up @@ -276,7 +289,7 @@ dotnet test CHDStudio.Tests/CHDStudio.Tests.csproj -c Release --filter "FullyQua
dotnet pack PBPSharp/PBPSharp.csproj -c Release -o <out-dir> -p:EnablePackageValidation=true

# 3. inspect the nupkg: README.md, icon.png, and lib/<tfm>/<name>.dll + .xml
# for net8.0, net9.0 and net10.0
# for net8.0, net9.0, net10.0 and net11.0

# 4. push with the user environment key (never hard-code it)
dotnet nuget push <out-dir>/PBPSharp.<version>.nupkg --api-key $env:NUGET_API_KEY --source https://api.nuget.org/v3/index.json
Expand All @@ -286,7 +299,7 @@ Invoke-RestMethod https://api.nuget.org/v3-flatcontainer/pbpsharp/index.json #
```

Before pushing, smoke-test the packed `.nupkg` in a throwaway consumer project
targeting `net8.0;net9.0;net10.0` (restore from a local package source and open
targeting `net8.0;net9.0;net10.0;net11.0` (restore from a local package source and open
a real file on each runtime).

## CI workflows
Expand Down
6 changes: 3 additions & 3 deletions CCDSharp/CCDSharp.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0;net10.0;net11.0</TargetFrameworks>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>
<LangVersion>15.0</LangVersion>
<NeutralLanguage>en</NeutralLanguage>
<Company>PureLogicCode.com</Company>
<AssemblyVersion>1.0.3</AssemblyVersion>
Expand Down Expand Up @@ -39,7 +39,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Meziantou.Analyzer" Version="3.0.322">
<PackageReference Include="Meziantou.Analyzer" Version="3.0.339">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
8 changes: 4 additions & 4 deletions CCDSharp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/purelogiccode/CHDStudio/badge)](https://securityscorecards.dev/viewer/?uri=github.com/purelogiccode/CHDStudio)
[![Security Policy](https://img.shields.io/badge/Security-Policy-blue.svg)](https://github.com/purelogiccode/CHDStudio/blob/master/SECURITY.md)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/purelogiccode/CHDStudio)
[![.NET 8 | 9 | 10](https://img.shields.io/badge/.NET-8.0%20%7C%209.0%20%7C%2010.0-512bd4.svg)](https://dotnet.microsoft.com/download)
[![.NET 8 | 9 | 10 | 11](https://img.shields.io/badge/.NET-8.0%20%7C%209.0%20%7C%2010.0%20%7C%2011.0-512bd4.svg)](https://dotnet.microsoft.com/download)
[![Platform: Windows | Linux | macOS](https://img.shields.io/badge/Platform-Windows%20%7C%20Linux%20%7C%20macOS-0078d7.svg)](https://github.com/purelogiccode/CHDStudio)
[![GitHub last commit](https://img.shields.io/github/last-commit/purelogiccode/CHDStudio)](https://github.com/purelogiccode/CHDStudio/commits/master)
[![GitHub stars](https://img.shields.io/github/stars/purelogiccode/CHDStudio.svg)](https://github.com/purelogiccode/CHDStudio/stargazers)
Expand All @@ -28,7 +28,7 @@
[![Release downloads](https://img.shields.io/github/downloads/purelogiccode/CHDStudio/total?label=release%20downloads)](https://github.com/purelogiccode/CHDStudio/releases)
[![Release date](https://img.shields.io/github/release-date/purelogiccode/CHDStudio?label=released)](https://github.com/purelogiccode/CHDStudio/releases)
[![C#](https://img.shields.io/badge/C%23-100%25-239120?logo=csharp&logoColor=white)](https://learn.microsoft.com/dotnet/csharp/)
[![NuGet TFMs](https://img.shields.io/badge/NuGet-net8.0%20%7C%20net9.0%20%7C%20net10.0-004880?logo=nuget&logoColor=white)](https://www.nuget.org/packages/CCDSharp)
[![NuGet TFMs](https://img.shields.io/badge/NuGet-net8.0%20%7C%20net9.0%20%7C%20net10.0%20%7C%20net11.0-004880?logo=nuget&logoColor=white)](https://www.nuget.org/packages/CCDSharp)
[![Format](https://img.shields.io/badge/format-CloneCD%20%2F%20CCD%20%2F%20IMG%20%2F%20SUB-6f42c1)](https://www.nuget.org/packages/CCDSharp)
[![Output](https://img.shields.io/badge/output-ISO%20%2B%20CUE%2FBIN-0b7285)](https://www.nuget.org/packages/CCDSharp)

Expand Down Expand Up @@ -83,8 +83,8 @@ The library is the CloneCD conversion engine used by [CHD Studio](https://github

| Requirement | Value |
|---|---|
| Target frameworks | `net8.0`, `net9.0`, `net10.0` |
| Runtime | .NET 8, .NET 9 or .NET 10 |
| Target frameworks | `net8.0`, `net9.0`, `net10.0`, `net11.0` |
| Runtime | .NET 8, .NET 9, .NET 10 or .NET 11 |
| Platforms | Windows, Linux, macOS (pure managed code) |
| Dependencies | None |

Expand Down
28 changes: 28 additions & 0 deletions CHDStudio.Tests/ArchiveServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1321,6 +1321,34 @@
);
}

[Fact]
public async Task ExtractArchiveAsyncUnstartableToolReturnsItsPathAndReason()
{
// A bundled 7zz extracted without the execute bit (or a file that is not a real
// executable) used to surface as a bare Win32Exception in the bug report. The fallback
// must name the tool and explain what to do instead.
var fakeTool = Path.Combine(
_tempDir,
OperatingSystem.IsWindows() ? "fake7za.exe" : "fake7za"
);
Comment on lines +1330 to +1333
Comment on lines +1330 to +1333
File.WriteAllText(fakeTool, "not an executable");
var service = new ArchiveService(fakeTool, true);
var corruptPath = Path.Combine(_tempDir, "corrupt-unstartable.7z");
File.WriteAllText(corruptPath, "not a 7z archive");
var tempDir = Path.Combine(_tempDir, "extract");

var result = await service.ExtractArchiveAsync(
corruptPath,
tempDir,
static _ => { },
CancellationToken.None
);

Assert.False(result.Success);
Assert.Contains("Could not start", result.ErrorMessage, StringComparison.Ordinal);
Assert.Contains(fakeTool, result.ErrorMessage, StringComparison.Ordinal);
}

[Fact]
public async Task ExtractArchiveAsyncCorrupt7ZWithout7ZaReturnsFailure()
{
Expand Down
4 changes: 4 additions & 0 deletions CHDStudio.Tests/BugReportServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,10 @@ public async Task SendBugReportAsyncReturnsFalseOnBadRequest()
[InlineData(
" Could not write the extracted files for 'Zusar Vasar (JP).chd': Extraction failed; track 3: Chderrwriteerror The output drive could not be written: it may be full, disconnected, read-only, or access may be denied."
)]
// The staging folder for an extraction could not be created in the chosen output folder.
[InlineData(
" Could not create the extraction folder for 'TengaiII_KO_Native_v54.chd': The output folder \"C:\\Users\\player\\Downloads\" cannot be written (access was denied)."
)]
// Conversion-time permission guidance for a write-protected output folder.
[InlineData(
" Conversion of 'Need for Speed - Hot Pursuit 2 (Europe, Australia) (En,Fr,De,Es,It,Sv) (v2.00).iso' failed due to a permission error. The output folder may be write-protected or require administrator rights."
Expand Down
7 changes: 4 additions & 3 deletions CHDStudio.Tests/CHDStudio.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0-windows</TargetFramework>
<TargetFramework>net11.0-windows</TargetFramework>
<LangVersion>15.0</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
Expand All @@ -15,11 +16,11 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Meziantou.Analyzer" Version="3.0.322">
<PackageReference Include="Meziantou.Analyzer" Version="3.0.339">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.11.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.12.0" />
<PackageReference Include="Roslynator.Analyzers" Version="5.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Loading
Loading