yavsc/src/Yavsc.Server
Paul Schneider 7f84d4d97a
fix(billing): tolerate ReflectionTypeLoadException during init
ConfigureBillingService() walks AppDomain.CurrentDomain.GetAssemblies()
and calls Assembly.GetTypes() on each. If any of the loaded assemblies
has a type that fails to resolve (a flaky dependency, an AddOn with a
broken reference, a test dependency that's been rewritten after compile),
GetTypes() throws ReflectionTypeLoadException (or, less commonly,
FileNotFoundException / TypeLoadException for the assembly itself).

In CI on the forgejo-runner (and especially in test discovery under
xunit v3), one such assembly is loaded somewhere between test runs and
silently throws. The exception is not handled, so:

  1. Collections are Cleared at the top of ConfigureBillingService().
  2. The reflection loop throws before reaching the
     RegisterBilling<HairCutQuery/HairMultiCutQuery/RdvQuery> calls.
  3. BillingService.Billing ends up empty (Count = 0).
  4. The second ConfigureBillingService() call sees the same assembly
     loaded (xunit v3 keeps the AppDomain warm for the whole suite),
     throws identically, and the test
     Yavsc.BillingServiceTests.ConfigureBillingService_CanBeCalledTwiceWithoutThrowing
     fails with 'Assert.Equal() Failure: Expected 3, Actual 0'.

Fix: catch ReflectionTypeLoadException and use the partial
.Types() list (the successfully-resolved subset), and use a
broader catch (with continue) for any other assembly-level
load failure. The lost user-settings types are not material;
they are derived from ApplicationDbContext in a separate loop
right after, and the RegisterBilling<>() calls that populate
BillingService.Billing run last, after both reflective phases
have completed best-effort.

The test still passes locally because the local test environment
loads a clean set of assemblies; only the CI runner (with its
extra test-time tooling) hits this path.
2026-08-16 16:35:05 +01:00
..
.config reorg 2026-02-28 21:17:54 +00:00
Exceptions reorg 2026-02-28 21:17:54 +00:00
Helpers fix(billing): tolerate ReflectionTypeLoadException during init 2026-08-16 16:35:05 +01:00
Hubs fixes the compile and timestamps to db 2026-07-11 03:26:13 +01:00
Interfaces refacto chathub 2026-07-04 15:28:07 +01:00
Models refacto BlogPost serialization 2026-08-05 21:05:14 +01:00
Properties reorg 2026-02-28 21:17:54 +00:00
Resources presentation 2026-07-01 00:13:57 +01:00
Services Activity protection 2026-08-10 18:12:59 +01:00
Settings Split Site:Audience into Site:ExternalUrl + Site:CorsAllowedOrigins 2026-06-19 13:15:21 +01:00
Templates reorg 2026-02-28 21:17:54 +00:00
ViewModels tests 2026-07-06 00:47:35 +01:00
ChatUserFlags.cs reorg 2026-02-28 21:17:54 +00:00
Config.cs about to test remote access 2026-04-19 16:02:50 +01:00
Constants.cs refact and login 2026-03-09 02:07:42 +00:00
Directory.Packages.props deploying the blogs 2026-06-19 23:09:43 +01:00
Makefile Claude me donne confiance. 2026-05-24 00:59:38 +01:00
ServerCommands.cs reorg 2026-02-28 21:17:54 +00:00
Yavsc.Server.csproj Exploiting GitVersion 2026-06-28 14:11:26 +01:00