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 — Recognise a native host as having no configuration system (#162) by FreeAndNil · Pull Request #311 · apache/logging-log4net

Conversation

@FreeAndNil

@FreeAndNil FreeAndNil commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Fixes #162

In a process that hosts the runtime natively there is no entry assembly for the
configuration system to derive the config file path from, so reading an
application setting fails in ClientConfigPaths with a PlatformNotSupportedException
wrapped in a ConfigurationErrorsException. That matched none of the shapes
IsMissingConfigurationSystem recognised, so log4net blamed the user's config file
and repeated the report for every setting the static constructors read: seven
log4net:ERROR blocks with a stack trace each, at startup, in a well configured
application.

A PlatformNotSupportedException anywhere in the inner exception chain is now
treated as an absent configuration system, the same as the Native AOT case. A
malformed config file cannot produce one, so unlike the FileNotFoundException and
TypeLoadException cases it needs no check on which assembly it came from. The
failure is logged once at debug level and application settings come from
environment variables.

Verified on Windows in a C++ host of the CoreCLR built for the purpose, in a host
that loads the runtime through hostfxr, and in powershell.exe loading a
netstandard2.0 build output: seven error blocks before, none after, and exactly one
debug line with log4net.Internal.Debug on.

Sorry, something went wrong.

Uh oh!

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

All reactions
FreeAndNil and others added 2 commits August 19, 2026 22:44
@FreeAndNil @claude
Recognise a native host as having no configuration system (#162)
13d931e
In a process that hosts the runtime natively there is no entry assembly for the
configuration system to derive the config file path from, so reading an
application setting fails in ClientConfigPaths with a PlatformNotSupportedException
wrapped in a ConfigurationErrorsException. That matched none of the shapes
IsMissingConfigurationSystem recognised, so log4net blamed the user's config file
and repeated the report for every setting the static constructors read: seven
log4net:ERROR blocks with a stack trace each, at startup, in a well configured
application.

A PlatformNotSupportedException anywhere in the inner exception chain is now
treated as an absent configuration system, the same as the Native AOT case. A
malformed config file cannot produce one, so unlike the FileNotFoundException and
TypeLoadException cases it needs no check on which assembly it came from. The
failure is logged once at debug level and application settings come from
environment variables.

Verified on Windows in a C++ host of the CoreCLR built for the purpose, in a host
that loads the runtime through hostfxr, and in powershell.exe loading a
netstandard2.0 build output: seven error blocks before, none after, and exactly one
debug line with log4net.Internal.Debug on.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@FreeAndNil @claude
Guard the native host case in CI (#162)
24457a6
The unit test for a natively hosted process builds the exception by hand, so it
asserts what we believe the configuration system does rather than what it does.
This adds a check that removes the entry assembly for real and reports what
log4net writes while starting up, in the project that already exists to record
what log4net can do in an unusual host.

It cannot be one of the probes in the list: the configuration system caches its
initialization and log4net reads its first application setting from a static
constructor, so by the time any probe runs the outcome is already decided. The
check therefore owns the process from its first statement and the runner selects
it with an argument.

Verified in both directions: it passes as committed, and reverting the
PlatformNotSupportedException case makes it exit non-zero and print the seven
error blocks it captured.

JIT compiled only, deliberately. Native AOT trims the configuration system away,
so the first setting read there fails as a missing constructor long before it can
fail for want of an entry assembly: the published executable passes this check
even with the fix reverted, which would be a green that cannot fail for the
reason the check exists. The reason is recorded next to the CI step and on the
class, so it does not get added back for symmetry.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@FreeAndNil
FreeAndNil requested review from fluffynuts and gdziadkiewicz August 19, 2026 20:53
@FreeAndNil FreeAndNil added this to the 3.4.1 milestone Aug 19, 2026
@FreeAndNil @claude
Document the pattern layout tests
36aa1ed
Every test method, the fixture hooks and the layout factories now carry a
summary saying what they assert, as does the converter that feeds arbitrary
names to NamedPatternConverter. The factories note that
DynamicPatternLayoutTest inherits this fixture and reruns the whole suite
against a DynamicPatternLayout, which is not obvious from either file.

The conditional using directive that came with it keeps System.Linq out of the
net462 compilation, where nothing uses it, which clears an IDE0005 warning.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@FreeAndNil
FreeAndNil force-pushed the Feature/162-quiet-app-settings-in-a-native-host branch from 633d028 to 36aa1ed Compare August 19, 2026 20:56
@FreeAndNil FreeAndNil mentioned this pull request Aug 19, 2026
PlatformNotSupportedExceptions when loading log4net #162
Closed
fluffynuts
fluffynuts approved these changes Aug 20, 2026
View reviewed changes
@FreeAndNil
FreeAndNil merged commit 8bb9233 into master Aug 20, 2026
3 checks passed

Uh oh!

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

@FreeAndNil
FreeAndNil deleted the Feature/162-quiet-app-settings-in-a-native-host branch August 20, 2026 05:45
This was referenced Oct 1, 2026
Bump the all-nuget-updates group with 5 updates drmoisan/TaskMaster#962
Closed
Bump the nuget-dependencies group with 13 updates SvenGroot/JumboCore#65
Closed
Bump log4net and 11 others SvenGroot/JumboCore#66
Closed
Bump log4net from 3.4.0 to 3.5.0 loresoft/KickStart#327
Merged
Bump log4net from 3.4.0 to 3.5.0 ParadoxGameConverters/PGCG.commonItems#941
Merged
Bump log4net from 3.3.1 to 3.5.0 bbtsoftware/AzureDevOpsPolicyConfigurator#253
Closed
Bump the dependencies group with 5 updates guibranco/CrispyWaffle#1000
Merged
Bump the nuget-minor-and-patch group with 1 update filmliga66/drive-mapper#16
Merged
Bump log4net from 3.4.0 to 3.5.0 OPCFoundation/UA-EdgeTranslator#143
Merged
Bump log4net from 3.4.0 to 3.5.0 overdrive1708/FastFileReadonly#19
Merged
Bump the all-updates group with 1 update frasermolyneux/demo-manager#78
Merged
Bump the dotnet-minor-and-patch group with 26 updates sheshankchandra/EggLedger#113
Closed
deps: Bump log4net from 3.3.2 to 3.5.0 OliverRetro/WavePlus#51
Closed
chore: Bump log4net from 3.4.0 to 3.5.0 mdallago/MDLSoft.NHibernate.AspNet#11
Merged
Bump log4net from 3.4.0 to 3.5.0 AlexHedley/poker-recording#377
Merged
Bump log4net from 3.4.0 to 3.5.0 TahsinCr/guidora-backend#13
Closed
DEV: Bump log4net from 3.4.0 to 3.5.0 origam/origam#4973
Merged
This was referenced Oct 8, 2026
Bump the all-nuget-updates group with 16 updates drmoisan/TaskMaster#984
Closed
Bump AngleSharp and 15 others drmoisan/TaskMaster#988
Merged
This was referenced Nov 12, 2026
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
DEV: Bump log4net from 3.4.0 to 3.5.0 origam/origam#5193
Merged
DEV: Bump log4net from 3.4.0 to 3.5.0 origam/origam#5194
Merged
DEV: Bump log4net from 3.4.0 to 3.5.0 origam/origam#5195
Merged
DEV: Bump log4net from 3.4.0 to 3.5.0 origam/origam#5196
Merged
DEV: Bump log4net from 3.4.0 to 3.5.0 origam/origam#5197
Merged
DEV: Bump log4net from 3.4.0 to 3.5.0 origam/origam#5198
Merged
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.5.0

Development

Successfully merging this pull request may close these issues.

PlatformNotSupportedExceptions when loading log4net

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.