mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-10-18 04:47:04 +02:00
On SQLite, INTEGER PRIMARY KEY AUTOINCREMENT values flow through
Dapper as boxed long. `int banId = ban.id;` / `int muteId = mute.id;`
against a dynamic row triggers RuntimeBinderException
("Cannot implicitly convert type 'long' to 'int'") before any
INSERT/UPDATE runs, and the surrounding bare `catch { }` in
BanManager.UnbanPlayer swallows it — leaving sa_bans.status='ACTIVE',
sa_unbans empty, and the admin staring at a cosmetic
"Unbanned with pattern X." reply. MySQL is unaffected because
MySqlConnector materialises INT as int.
Normalise the conversion path via Convert.ToInt32((object)x.id),
which handles both boxed int (MySQL) and boxed long (SQLite)
without invoking the C# dynamic binder. Same pattern fixed in
both UnbanPlayer and UnmutePlayer.
Also tighten BanManager.UnbanPlayer's bare `catch { }` to log via
the existing CS2_SimpleAdmin.Instance.Logger, matching the style
of BanPlayer/AddBanBySteamid/AddBanByIp in the same file. This is
what surfaced the bug during root-cause analysis.
|
||
|---|---|---|
| .. | ||
| BanManager.cs | ||
| CacheManager.cs | ||
| DiscordManager.cs | ||
| MuteManager.cs | ||
| PermissionManager.cs | ||
| PlayerManager.cs | ||
| PlayerPenaltyManager.cs | ||
| ServerManager.cs | ||
| WarnManager.cs | ||