GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — dotnet 10 build cleanup by FreeAndNil · Pull Request #305 · apache/logging-log4net

Conversation

@FreeAndNil

@FreeAndNil FreeAndNil commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Why

The sources already use C# 14 (the field keyword in SmtpAppender's property accessors), which
requires the .NET 10 SDK. Nothing in the repo declared that: the test projects targeted net8.0,
CI installed .NET 8 and the Dockerfile fetched the 8.0 channel, so a clean checkout could not
compile - it failed with CS0501: 'SmtpAppender.To.get' must declare a body.

This PR makes the required toolchain explicit and cleans up the surrounding build, which turned up
several unrelated defects along the way.

The shipped surface is unchanged. log4net still targets net462;netstandard2.0 and
log4net.Ext.Mail still targets netstandard2.0. Nothing here affects consumers.

Changes

Commit What
Target .NET 10 / C# 14 test and integration-test projects net8.0 → net10.0; CI dotnet-version: 10
Build net4x without Mono delete MonoForFramework.targets and its two imports
Container image from the .NET 10 SDK image ubuntu:20.04 + dotnet-install.sh →
mcr.microsoft.com/dotnet/sdk:10.0-noble
Stop the release scripts on failed steps $PSNativeCommandUseErrorActionPreference in both scripts, plus a path
fix
Fix the log4net.Ext.Mail package readme NU5039
Quieten the TelnetAppender test graceful socket shutdown
Update BUILDING.md document what the build actually is

Mono is no longer needed to build net4x

MonoForFramework.targets set FrameworkPathOverride to Mono's 4.6.2-api directory on Unix. That
is obsolete: the .NET SDK already adds an implicit PackageReference to
Microsoft.NETFramework.ReferenceAssemblies.<tfm> for net4x targets, and those packages were
already in the restore graph.

net462 tests are now Windows-only

VSTest hosts net4x tests through TestHostNetFramework/testhost.exe, a .NET Framework executable,
so dotnet test aborts with TESTRUNABORT on Linux and macOS. log4net.Tests now conditions its
TargetFrameworks on '$(OS)' != 'Windows_NT', so no unrunnable test assembly is produced. The
net462 library is still built on every platform; only the test target is gated.

This also fixes the ubuntu-22.04 and macos-14 CI jobs, which ran a bare dotnet test against a
net462 target they could not host.

Run CI on the latest runner images

macos-14 and ubuntu-22.04 are superseded by macos-latest (macOS 26) and ubuntu-latest (Ubuntu 24.04).
Neither new image ships Mono, so net4x tests cannot run there - which is why log4net.Tests restricts net462 to Windows.

Release scripts continued after failed steps

$ErrorActionPreference = 'Stop' does not apply to native commands — they only set
$LASTEXITCODE. A failing dotnet, git, zip, gpg or mvnw was therefore ignored, and
artifacts were packaged, signed and tagged anyway. Both scripts now set
$PSNativeCommandUseErrorActionPreference (PowerShell 7.3+).

This was not theoretical: NU5039 made the log4net.Ext.Mail pack fail, no .nupkg was produced,
and build-preview.ps1 went on to gpg-sign files that did not exist. build-preview.ps1 also built
its artifact paths with backslashes, which are not path separators outside Windows.

TelnetAppender test noise

SimpleTelnetClient.Dispose() disposed the TcpClient while the reader was blocked in
stream.Read, so teardown aborted the socket and dumped an IOException with a stack trace on
every passing run. The cancellation token never actually broke the loop — it was only checked after
a successful read. Now the socket is shut down first, the read returns 0, and the loop exits
normally. Exceptions arriving after disposal starts are not reported; genuine failures still are.

Verification

On Linux (Ubuntu-based, .NET SDK 10.0.110, self-built Mono present but unused by the build):

  • dotnet build ./src/log4net.sln - succeeds, 0 warnings
  • dotnet test ./src/log4net.sln - 292 total, 0 failed, 281 succeeded, 11 skipped (Windows-only)
  • net462 and net472 compile with MonoForFramework.targets deleted
  • log4net.Tests.Signing.AssemblyShouldBeSigned passes - strong naming survives the
    reference-assembly switch
  • ./mvnw site works
  • both scripts parse under pwsh 7.6.4; the native-error behaviour was verified directly

For reviewers to weigh

Nothing tests on the .NET 8 runtime any more. netstandard2.0 consumers on .NET 8 (LTS until
November 2026) are still supported but no longer exercised.

The MCR image reference is fully qualified, so it needs no registry configuration and no login.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@FreeAndNil FreeAndNil added this to the 3.4.0 milestone Aug 4, 2026
@FreeAndNil
FreeAndNil requested review from fluffynuts and gdziadkiewicz August 4, 2026 22:05
FreeAndNil added a commit that referenced this pull request Aug 4, 2026
@FreeAndNil
Run CI on the latest runner images (#305)
2924e87
  macos-14 and ubuntu-22.04 are superseded by macos-latest (macOS 26) and
  ubuntu-latest (Ubuntu 24.04). Neither new image ships Mono, so net4x
  tests cannot run there - which is why log4net.Tests restricts net462 to
  Windows. Correct the reason given in BUILDING.md and the changelog.
FreeAndNil added a commit that referenced this pull request Aug 4, 2026
@FreeAndNil
Remove the Mono guards from the tests (#305)
68b9a4d
 - Utils.IsMono and Utils.InconclusiveOnMono are gone, along with all 15 call sites. The net462 tests run only on Windows now and the net10.0 tests run on .NET 10, so the guard could never fire.
- SystemInfo.IsMono in the library is deliberately untouched: it detects the runtime executing log4net, which can still be Mono.
@FreeAndNil
FreeAndNil force-pushed the Feature/305-dotnet-10-build-cleanup branch from 87bb3d2 to 68b9a4d Compare August 4, 2026 22:20
FreeAndNil added a commit that referenced this pull request Aug 4, 2026
@FreeAndNil
Remove the Mono guards from the tests (#305)
6dee635
Utils.IsMono and Utils.InconclusiveOnMono are gone, along with all 15 call sites.
The net462 tests run only on Windows now and the net10.0 tests run on .NET 10, so the guard could never fire.

SystemInfo.IsMono in the library is deliberately untouched: it detects the runtime executing log4net, which can still be Mono.
@FreeAndNil
FreeAndNil force-pushed the Feature/305-dotnet-10-build-cleanup branch from 68b9a4d to 6dee635 Compare August 4, 2026 22:26
FreeAndNil added 9 commits August 5, 2026 00:30
@FreeAndNil
Target .NET 10 / C# 14 for tests
c9e278b
  The sources use C# 14, so a .NET 10 SDK is now required. Test and
  integration-test projects move from net8.0 to net10.0; the shipped
  log4net assembly keeps net462;netstandard2.0.
@FreeAndNil
Build net4x without Mono
7f63f49
  Remove MonoForFramework.targets and its FrameworkPathOverride handling.
  The net462/net472 targets compile against the   Microsoft.NETFramework.ReferenceAssemblies packages that the .NET SDK
  already references implicitly, so Mono is only needed to run .NET
  Framework assemblies - not to build them (and mono is now deprecated by Microsoft).
@FreeAndNil
Build the container image from the .NET 10 SDK image
2721641
  Replace ubuntu:20.04 + dotnet-install.sh with
  mcr.microsoft.com/dotnet/sdk:10.0-noble - Ubuntu 24.04 with the SDK
  preinstalled. Drops the Mono packages, the apt-key/stable-focal repo,
  wget, tree and the DOTNET_ROOT/PATH handling, leaving no apt layer at
  all. Ubuntu 20.04 left standard support in April 2025.
@FreeAndNil
Stop the release scripts on failed steps
96123c9
  $ErrorActionPreference does not apply to native commands, so a failing
  dotnet, git, zip, gpg or mvnw was ignored and the artifacts were
  packaged, signed and tagged anyway. Both scripts now set
  $PSNativeCommandUseErrorActionPreference (PowerShell 7.3+).

  Also fix build-preview.ps1 outside Windows, where the artifact paths
  handed to gpg used backslashes.
@FreeAndNil
Fix the log4net.Ext.Mail package readme
9fab1ad
  PackageReadmeFile requires the readme at the package root, so packing
  README.md without a PackagePath failed with NU5039. Matches the pattern
  already used in log4net.csproj.
@FreeAndNil
Quieten the TelnetAppender test
d398490
  Dispose disposed the TcpClient while the reader was blocked in
  stream.Read, so teardown always aborted the socket and dumped an
  IOException with a stack trace, even on a passing run. Shut the socket
  down first, so the read returns 0 and the loop ends normally, and only
  report exceptions that arrive before disposal. Progress chatter removed;
  the test now prints nothing unless it fails.

  Two things this fixes beyond the noise:

  - The cancellation token never actually stopped the loop. The check ran only after a successful read, so the reader
  could only be broken by disposing the socket under it. Now Shutdown(SocketShutdown.Both) ends the stream and the loop
  exits through its normal condition.
  - Diagnostics are preserved for real failures. log is still wired to TestContext.Out.WriteLine, gated on !_disposing - so a genuine client error still surfaces, and Assert.Fail on timeout still reports what was received.
@FreeAndNil
Update BUILDING.md to match the actual build
a73070c
@FreeAndNil
Run CI on the latest runner images (#305)
cfeb2e5
  macos-14 and ubuntu-22.04 are superseded by macos-latest (macOS 26) and
  ubuntu-latest (Ubuntu 24.04). Neither new image ships Mono, so net4x
  tests cannot run there - which is why log4net.Tests restricts net462 to
  Windows. Correct the reason given in BUILDING.md and the changelog.
@FreeAndNil
Remove the Mono guards from the tests (#305)
98742f2
Utils.IsMono and Utils.InconclusiveOnMono are gone, along with all 15 call sites.
The net462 tests run only on Windows now and the net10.0 tests run on .NET 10, so the guard could never fire.

SystemInfo.IsMono in the library is deliberately untouched: it detects the runtime executing log4net, which can still be Mono.
@FreeAndNil
FreeAndNil force-pushed the Feature/305-dotnet-10-build-cleanup branch from 6dee635 to 98742f2 Compare August 4, 2026 22:30
fluffynuts
fluffynuts reviewed Aug 5, 2026
View reviewed changes
Comment thread src/log4net.Tests/log4net.Tests.csproj Resolved

Uh oh!

There was an error while loading. Please reload this page.

fluffynuts
fluffynuts approved these changes Aug 5, 2026
View reviewed changes
@FreeAndNil
FreeAndNil merged commit 9a64f95 into master Aug 5, 2026
3 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@FreeAndNil
FreeAndNil deleted the Feature/305-dotnet-10-build-cleanup branch August 5, 2026 06:51
This was referenced Aug 21, 2026
Bump log4net from 3.3.2 to 3.4.0 OPCFoundation/UA-EdgeTranslator#118
Merged
Bump log4net from 3.3.2 to 3.4.0 overdrive1708/FastFileReadonly#13
Merged
Bump log4net from 3.3.2 to 3.4.0 afonsoft/EAF#377
Merged
Bump log4net and Microsoft.Extensions.Logging.Console quartznet/quartznet#3354
Merged
Bump the all-updates group with 5 updates frasermolyneux/demo-manager#67
Merged
Bump Aspire.Hosting.AppHost and 14 others sheshankchandra/EggLedger#74
Closed
deps: Bump log4net from 3.3.2 to 3.4.0 wojciechowskiapp/Kaption#13
Closed
Bump the nuget-dependencies group with 10 updates SvenGroot/JumboCore#51
Closed
This was referenced Nov 10, 2026
Bump the minor-version-updates group with 5 updates PxTools/PCAxis.Serializers#219
Merged
Bump the nuget-dependencies group with 14 updates SvenGroot/JumboCore#76
Closed
Bump Crc32.NET and 12 others SvenGroot/JumboCore#77
Closed
Bump log4net from 3.3.2 to 3.5.0 filadelfija-cyber/Reposter#1
Merged
Bump log4net from 3.2.0 to 3.5.0 marcmy/ProtonVPN-win-app#153
Closed
Dependency (dependabot/nuget): Bump log4net from 3.2.0 to 3.5.0 sg-scale/NETworkManager--2025.10.18.0#10
Open
Bump the nuget-dependencies group with 14 updates SvenGroot/JumboCore#78
Closed
Bump Crc32.NET and 12 others SvenGroot/JumboCore#79
Closed
Bump log4net from 3.3.2 to 3.5.0 jasonlandreth/GarminR10-BLE-Connector#6
Closed
Bump log4net from 3.3.0 to 3.5.0 chutch3/kenku#87
Merged
Bump log4net from 2.0.15 to 3.6.0 sg-scale/NETworkManager--2022.12.20.0#5
Open
Bump the minor-version-updates group with 4 updates PxTools/PCAxis.Menu.OracleDatamodelMenu#115
Merged
Bump log4net and 3 others PxTools/PCAxis.Metadata#108
Merged
Bump Crc32.NET and 12 others SvenGroot/JumboCore#80
Closed
Bump the nuget-dependencies group with 14 updates SvenGroot/JumboCore#81
Closed
Bump log4net and 4 others PxTools/PCAxis.Menu.MsSqlDatamodelMenu#114
Merged
Bump log4net and 3 others PxTools/PXWeb.SavedQuery.Oracle#119
Merged
Bump log4net and 4 others PxTools/PCAxis.Core#142
Merged
Bump log4net from 3.3.1 to 3.6.0 bbtsoftware/AzureDevOpsPolicyConfigurator#255
Open
Bump the minor-version-updates group with 4 updates PxTools/PCAxis.Menu#100
Merged
Bump log4net and 3 others PxTools/PCAxis.Query#113
Merged
Bump log4net and PCAxis.Core PxTools/PCAxis.Query#114
Closed
Bump log4net from 2.0.8 to 3.6.0 devsecops-lab-luis/demo-ghas-multilenguaje#27
Open
Dependency (dependabot/nuget): Bump log4net from 3.3.0 to 3.6.0 Nevergoodstudy/NETworkManager-macOS#24
Open
Bump the nuget-dependencies group with 14 updates SvenGroot/JumboCore#82
Open
Bump Crc32.NET and 12 others SvenGroot/JumboCore#83
Open
deps: Bump log4net from 3.3.2 to 3.6.0 OliverRetro/WavePlus#62
Open
Bump log4net from 3.3.1 to 3.6.0 bNobo/needabreak#176
Open
This was referenced Nov 19, 2026
Bump log4net from 3.3.2 to 3.6.0 jasonlandreth/GarminR10-BLE-Connector#7
Open
Bump Crc32.NET and 12 others SvenGroot/JumboCore#84
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@fluffynuts fluffynuts fluffynuts approved these changes
@gdziadkiewicz gdziadkiewicz Awaiting requested review from gdziadkiewicz

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

3.4.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@FreeAndNil @fluffynuts
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.