Skip to content

Two Linux/Mono server fixes: dead REST API + login username case#106

Merged
AdaInTheLab merged 2 commits into
mainfrom
fix/mono-linux-server-fixes
Jun 17, 2026
Merged

Two Linux/Mono server fixes: dead REST API + login username case#106
AdaInTheLab merged 2 commits into
mainfrom
fix/mono-linux-server-fixes

Conversation

@AdaInTheLab

Copy link
Copy Markdown
Collaborator

Two independent server-side fixes for the 7D2D Mono/Linux runtime, found and verified live during this session (orphaned in the working tree — lifting them into a PR so they aren't lost). Two scoped commits.

1. fix(web) — the entire REST API was dead on Mono

app.UseAutofacMiddleware / UseAutofacWebApi register Autofac's per-request lifetime-scope injector, which disposes via await usingIAsyncDisposable.DisposeAsync(). 7D2D's Mono runtime doesn't implement that method → MissingMethodException at JIT in front of the whole pipeline → every /api/* request 500'd on Linux. Removed those two calls; Web API's own AutofacWebApiDependencyResolver (already set) disposes the per-request scope synchronously via IDisposable.Dispose(), which Mono has. InstancePerRequest registrations still resolve (same RequestLifetimeScopeTag).
Verified: authed GET /api/users → 200.

2. fix(auth) — mixed-case usernames couldn't log in

UserController.Create stores username.Trim().ToLowerInvariant(), but HandleLogin passed the raw typed username to GetByUsername, and SQLite compares TEXT case-sensitively — so "KCAdmin" was stored "kcadmin" and never matched (looked like the admin password "rotating" / not working). Normalize the login username the same way.
Verified: "KCAdmin" → 200.

🤖 Generated with Claude Code

AdaInTheLab and others added 2 commits June 17, 2026 03:21
app.UseAutofacMiddleware / UseAutofacWebApi register Autofac.Integration.Owin's
per-request lifetime-scope injector, which disposes the scope via `await using`
→ IAsyncDisposable.DisposeAsync(). 7D2D's Mono runtime doesn't implement that
method, so it threw MissingMethodException at JIT in front of the whole pipeline
— taking down EVERY /api/* request on Linux/Mono.

Rely instead on Web API's own AutofacWebApiDependencyResolver (already set), which
creates + disposes the per-request scope SYNCHRONOUSLY via IDisposable.Dispose()
(which Mono has). InstancePerRequest registrations still resolve correctly (same
RequestLifetimeScopeTag). Verified live: authed GET /api/users → 200.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
UserController.Create stores username as Trim().ToLowerInvariant(), but
HandleLogin passed the raw typed username to GetByUsername, and SQLite compares
TEXT case-sensitively — so a username created/typed as "KCAdmin" was stored
"kcadmin" and never matched at login (presented as the admin password "rotating"
/ not working). Normalize the login username the same way. Verified: "KCAdmin" → 200.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@AdaInTheLab AdaInTheLab merged commit a2fb7da into main Jun 17, 2026
3 checks passed
@AdaInTheLab AdaInTheLab deleted the fix/mono-linux-server-fixes branch June 17, 2026 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant