Asset Bridge legacy-MUL art fails on Linux/Mono with [GDI+ NotImplemented] — finish the GDI+-free migration #39

Open
opened 2026-11-25 16:35:41 -06:00 by wtclaude · 0 comments
Member

Summary

On a Linux/Mono shard, the Asset Bridge's legacy-MUL image paths (the phase‑3 body
catalogue and phase‑5 item/land art) fail with [GDI+ status: NotImplemented]. The
phase‑4 UOP animation path is unaffected. The result: the ~787 legacy anim*.mul
catalogue sprites, and item/land art, do not render — so creature thumbnails and item art
partially break on the website (bestiary, marketplace, character sheets) when the shard
runs on Linux. On Windows every path works, which is why this surfaced only on the
Windows → Linux/Mono migration.

Installing or reinstalling libgdiplus does not fix it (confirmed on the live host):
this is not a loading problem. Mono finds libgdiplus.so.0 (6.1, the newest Ubuntu 24.04
offers); the NotImplemented is libgdiplus's own answer to a GDI+ operation that version
does not implement under Mono.

Root cause

The exact failing call is libgdiplus refusing to create a 16-bit bitmap, deep inside
ServUO's bundled Ultima.* SDK — before any overlay code runs. The pinned trace (Mono
detailed logging, 14,956 identical failures, body 1 action 0 … body 994 action 34):

Mono: DllImport loaded library '/usr/lib/libgdiplus.so.0'.
Mono: Found as 'GdipCreateBitmapFromScan0'.
System.NotImplementedException: ... [GDI+ status: NotImplemented]
  at System.Drawing.GDIPlus.CheckStatus (System.Drawing.Status)
  at System.Drawing.Bitmap..ctor (int, int, System.Drawing.Imaging.PixelFormat)
  at Ultima.Frame..ctor (uint16[], System.IO.BinaryReader, bool)
  at Ultima.Animations.GetAnimation (int, int, int, int&, bool, bool)
  at Server.Custom.Bridge.BridgeCatalog.Decode
  at Server.Custom.Bridge.BridgeCatalog.ReplyManifest
  at Server.Custom.Bridge.BridgeAssets.WorkLoop ()

Ultima.Frame's constructor does new Bitmap(width, height, Settings.PixelFormat), and
Settings.PixelFormat is 16-bit (Ultima/Settings.cs:10,12 — Format16bppRgb555 /
Format16bppArgb1555; Ultima/Animations.cs:960). Every UO animation frame is created as
a 16bpp image. libgdiplus on Linux cannot create 16bpp bitmaps and answers
NotImplemented from GdipCreateBitmapFromScan0; Windows' own GDI implementation (which
Mono-on-Windows calls) supports them, which is why it worked before the move. A different
libgdiplus build almost certainly will not help.

So the decode blows up inside the inherited SDK's Frame ctor, before the overlay ever
gets a Bitmap to encode. The overlay's own code then has a second, independent GDI+
dependency on the way back out (the encode/hue side), which the same migration must also
remove, but the decode is what fails first:

  • Body catalogue — overlay/Scripts/Custom/Bridge/BridgeCatalog.cs:720-730:
    Animations.GetAnimation(...) ← fails here → (would be) Frame[0].Bitmap →
    BridgeAssets.BitmapToPng(bitmap).
  • Item/land art — overlay/Scripts/Custom/Bridge/BridgeArt.cs:426-449: Art.GetLand /
    Art.GetStatic → Hue.ApplyTo(bitmap, partial) → BridgeAssets.BitmapToPng(bitmap).
    Almost certainly the same 16bpp‑ctor failure (same SDK, same Settings.PixelFormat),
    though the trace above is the animation path only.
  • Encode — overlay/Scripts/Custom/Bridge/BridgeAssets.cs:601-670 (BitmapToPng): LockBits /
    UnlockBits and Bitmap.Save(ms, ImageFormat.Png) — also GDI+, also to be removed.

The GDI+ dependency is inherited, not ours — and the escape path already exists in this
tree.
The phase‑4 UOP work was written specifically to avoid libgdiplus (see the comment
in BridgePng.cs:7-26 and BridgeUop.cs, "libgdiplus was archived in March 2025"):
BridgeUop decodes the UOP container to a ushort[] of ARGB1555 with "no Bitmap
anywhere", and BridgePng.FromArgb1555 encodes it. The legacy MUL path is simply the half
that was never migrated — BridgePng.cs:24-26 says as much: "Phase 3's
BridgeCatalog.ToPng is left exactly as it is … a path that needs GDI+ to produce the
pixels in the first place."

Why not just install a newer libgdiplus / use SkiaSharp or ImageSharp

  • Reinstalling / building libgdiplus: not a loading problem; 6.1 is the newest Ubuntu
    24.04 packages, and a from‑source build is a guess (it may or may not implement the exact
    op). Rejected as the primary fix.
  • SkiaSharp / ImageSharp: these are the right answer for an ordinary cross‑platform .NET
    app, but this plugin is deployed as source and compiled by ServUO at boot — there is no
    NuGet/package restore
    (see .claude/guides/servuo-plugins.md). SkiaSharp ships per‑OS
    native libraries; ImageSharp is a managed DLL — either must be vendored into the overlay
    and referenced by ServUO's boot compile, which is real friction for a source‑deployed
    tree. Also note the stack is .NET Framework 4.8 under Mono, not .NET 7+, so
    System.Drawing.Common's .NET‑7 non‑Windows removal does not apply here; the constraint
    is libgdiplus's NotImplemented gaps, not the managed API being gone.

Proposed fix

Finish the GDI+‑free migration the overlay already started, so Windows and Linux use the
same managed path
rather than a Linux‑specific workaround:

  • Bypass the SDK decode entirely — the 16bpp Bitmap is created inside
    Ultima.Frame/Animations.GetAnimation/Art.Get*, so no overlay‑side change can save
    that call; it must not be invoked on Linux. Reimplement the legacy decode
    (anim*.mul/art.mul → ARGB1555 ushort[]) and hue application (hues.mul +
    tiledata.mul PartialHue, as documented in BridgeArt.cs) against the raw bytes, the
    same way BridgeUop reimplemented the UOP container — then encode with the existing
    BridgePng. No System.Drawing, no new dependency.
  • Rejected alternative — patch Ultima/Settings.cs to a 32bpp format. A stock‑file
    patch (via patches/) changing Settings.PixelFormat to e.g. Format32bppArgb would let
    libgdiplus create the bitmap, but it ripples through all of Frame's 16‑bit pixel
    read/write (LockBits strides, the ARGB1555 packing) and every other SDK consumer, and it
    keeps the whole path on GDI+ (the encode still calls Save(Png)/LockBits). It trades a
    clean managed path for a fragile edit to inherited code — not preferred.
  • Message/wire shapes are unchanged → no PROTOCOL_VERSION bump; overlay‑only.
  • This is a substantial, somewhat architectural piece of work and should be scoped and
    design‑approved before coding — it is not a one‑liner like #37.

Evidence (live Linux/Mono shard, from an ops investigation)

  • ServUO runs mono ServUO.exe -release as user servuo; libgdiplus.so.0.0.0 (6.1) is
    loaded via Mono's own System.Drawing.dll. The [Bridge] [GDI+ status: NotImplemented]
    errors appear here — 14,956 identical failures across body 1 action 0 …
    body 994 action 34 during one catalogue import.
  • The uo‑link sidecar (runicgateway-link, user runicgateway) is native and does not
    link libgdiplus — it is not involved in image decode.
  • Exact failing call pinned via Mono detailed logging: the 16bpp Bitmap constructor in
    Ultima.Frame (full trace in Root cause above). GdipCreateBitmapFromScan0 →
    NotImplemented.
  • assets.bodies MissingMethodException (new bug, worth its own issue). During the same
    import: [Bridge] assets.bodies: greatape: MissingMethodException: Default constructor not found for type Server.Mobiles.GreatApe — same for Navrey, TribeChieftan,
    TribeShaman, TribeWarrior. The body→name path instantiates mobile types that have no
    parameterless constructor. Unrelated to GDI+; affects name resolution for those creatures.
  • Sidecar permission gap: /opt/servuo is drwxr-x--- servuo servuo, so the sidecar's
    runicgateway user cannot traverse/read DataPath.cfg, /opt/servuo/uo-data or
    Cliloc.enu. Harmless for the cliloc import (ServUO, as servuo, reads those and serves
    them over the bridge — see #37), but a latent trap worth closing, and the pre‑Nov‑22
    "Permission denied (os error 13)" sidecar‑log lines should be explained.
  • cliloc message does not appear in the ServUO log — expected. BridgeAssets.Fail
    emits an assets.error JSON over the bridge (BridgeLink.Emit) and never writes to the
    console, so the cliloc NOT_FOUND text authored in BridgeCliloc travels to the website
    and surfaces there, not on the shard. The ops finding of "0 cliloc lines on the ServUO
    VM" is consistent with that and does not contradict #37.
  • No CI build for this plugin (it compiles at boot). A Linux CI runner plus
    deployment‑level asset tests under the real service identity would have caught this; worth
    its own stream.
  • #37 (cliloc case‑sensitivity) is a different root cause and its fix stands.
## Summary On a Linux/Mono shard, the Asset Bridge's **legacy-MUL image paths** (the phase‑3 body catalogue and phase‑5 item/land art) fail with `[GDI+ status: NotImplemented]`. The phase‑4 UOP animation path is unaffected. The result: the ~787 legacy `anim*.mul` catalogue sprites, and item/land art, do not render — so creature thumbnails and item art partially break on the website (bestiary, marketplace, character sheets) when the shard runs on Linux. On Windows every path works, which is why this surfaced only on the Windows → Linux/Mono migration. Installing or reinstalling libgdiplus does **not** fix it (confirmed on the live host): this is not a loading problem. Mono finds `libgdiplus.so.0` (6.1, the newest Ubuntu 24.04 offers); the `NotImplemented` is libgdiplus's own answer to a GDI+ operation that version does not implement under Mono. ## Root cause **The exact failing call is libgdiplus refusing to create a 16-bit bitmap**, deep inside ServUO's bundled `Ultima.*` SDK — *before* any overlay code runs. The pinned trace (Mono detailed logging, 14,956 identical failures, `body 1 action 0` … `body 994 action 34`): ``` Mono: DllImport loaded library '/usr/lib/libgdiplus.so.0'. Mono: Found as 'GdipCreateBitmapFromScan0'. System.NotImplementedException: ... [GDI+ status: NotImplemented] at System.Drawing.GDIPlus.CheckStatus (System.Drawing.Status) at System.Drawing.Bitmap..ctor (int, int, System.Drawing.Imaging.PixelFormat) at Ultima.Frame..ctor (uint16[], System.IO.BinaryReader, bool) at Ultima.Animations.GetAnimation (int, int, int, int&, bool, bool) at Server.Custom.Bridge.BridgeCatalog.Decode at Server.Custom.Bridge.BridgeCatalog.ReplyManifest at Server.Custom.Bridge.BridgeAssets.WorkLoop () ``` `Ultima.Frame`'s constructor does `new Bitmap(width, height, Settings.PixelFormat)`, and `Settings.PixelFormat` is **16-bit** (`Ultima/Settings.cs:10,12` — `Format16bppRgb555` / `Format16bppArgb1555`; `Ultima/Animations.cs:960`). Every UO animation frame is created as a 16bpp image. **libgdiplus on Linux cannot create 16bpp bitmaps** and answers `NotImplemented` from `GdipCreateBitmapFromScan0`; Windows' own GDI implementation (which Mono-on-Windows calls) supports them, which is why it worked before the move. A different libgdiplus build almost certainly will not help. So the decode blows up inside the inherited SDK's `Frame` ctor, before the overlay ever gets a `Bitmap` to encode. The overlay's *own* code then has a second, independent GDI+ dependency on the way back out (the encode/hue side), which the same migration must also remove, but the decode is what fails first: - Body catalogue — `overlay/Scripts/Custom/Bridge/BridgeCatalog.cs:720-730`: `Animations.GetAnimation(...)` **← fails here** → (would be) `Frame[0].Bitmap` → `BridgeAssets.BitmapToPng(bitmap)`. - Item/land art — `overlay/Scripts/Custom/Bridge/BridgeArt.cs:426-449`: `Art.GetLand` / `Art.GetStatic` → `Hue.ApplyTo(bitmap, partial)` → `BridgeAssets.BitmapToPng(bitmap)`. Almost certainly the same 16bpp‑ctor failure (same SDK, same `Settings.PixelFormat`), though the trace above is the animation path only. - Encode — `overlay/Scripts/Custom/Bridge/BridgeAssets.cs:601-670` (`BitmapToPng`): `LockBits` / `UnlockBits` and `Bitmap.Save(ms, ImageFormat.Png)` — also GDI+, also to be removed. **The GDI+ dependency is inherited, not ours — and the escape path already exists in this tree.** The phase‑4 UOP work was written specifically to avoid libgdiplus (see the comment in `BridgePng.cs:7-26` and `BridgeUop.cs`, "libgdiplus was archived in March 2025"): `BridgeUop` decodes the UOP container to a `ushort[]` of ARGB1555 with "no `Bitmap` anywhere", and `BridgePng.FromArgb1555` encodes it. The legacy MUL path is simply the half that was never migrated — `BridgePng.cs:24-26` says as much: *"Phase 3's `BridgeCatalog.ToPng` is left exactly as it is … a path that needs GDI+ to produce the pixels in the first place."* ## Why not just install a newer libgdiplus / use SkiaSharp or ImageSharp - **Reinstalling / building libgdiplus:** not a loading problem; 6.1 is the newest Ubuntu 24.04 packages, and a from‑source build is a guess (it may or may not implement the exact op). Rejected as the primary fix. - **SkiaSharp / ImageSharp:** these are the right answer for an ordinary cross‑platform .NET app, but this plugin is **deployed as source and compiled by ServUO at boot — there is no NuGet/package restore** (see `.claude/guides/servuo-plugins.md`). SkiaSharp ships per‑OS native libraries; ImageSharp is a managed DLL — either must be vendored into the overlay and referenced by ServUO's boot compile, which is real friction for a source‑deployed tree. Also note the stack is **.NET Framework 4.8 under Mono**, not .NET 7+, so `System.Drawing.Common`'s .NET‑7 non‑Windows removal does not apply here; the constraint is libgdiplus's `NotImplemented` gaps, not the managed API being gone. ## Proposed fix Finish the GDI+‑free migration the overlay already started, so **Windows and Linux use the same managed path** rather than a Linux‑specific workaround: - **Bypass the SDK decode entirely** — the 16bpp `Bitmap` is created *inside* `Ultima.Frame`/`Animations.GetAnimation`/`Art.Get*`, so no overlay‑side change can save that call; it must not be invoked on Linux. Reimplement the legacy decode (`anim*.mul`/`art.mul` → ARGB1555 `ushort[]`) and hue application (`hues.mul` + `tiledata.mul` PartialHue, as documented in `BridgeArt.cs`) against the raw bytes, the same way `BridgeUop` reimplemented the UOP container — then encode with the existing `BridgePng`. No `System.Drawing`, no new dependency. - **Rejected alternative — patch `Ultima/Settings.cs` to a 32bpp format.** A stock‑file patch (via `patches/`) changing `Settings.PixelFormat` to e.g. `Format32bppArgb` would let libgdiplus create the bitmap, but it ripples through all of `Frame`'s 16‑bit pixel read/write (`LockBits` strides, the ARGB1555 packing) and every other SDK consumer, and it keeps the whole path on GDI+ (the encode still calls `Save(Png)`/`LockBits`). It trades a clean managed path for a fragile edit to inherited code — not preferred. - Message/wire shapes are unchanged → **no `PROTOCOL_VERSION` bump**; overlay‑only. - This is a substantial, somewhat architectural piece of work and should be scoped and design‑approved before coding — it is not a one‑liner like #37. ## Evidence (live Linux/Mono shard, from an ops investigation) - ServUO runs `mono ServUO.exe -release` as user `servuo`; `libgdiplus.so.0.0.0` (6.1) is loaded via Mono's own `System.Drawing.dll`. The `[Bridge]` `[GDI+ status: NotImplemented]` errors appear here — **14,956 identical failures** across `body 1 action 0` … `body 994 action 34` during one catalogue import. - The uo‑link sidecar (`runicgateway-link`, user `runicgateway`) is native and does **not** link libgdiplus — it is not involved in image decode. - Exact failing call pinned via Mono detailed logging: the 16bpp `Bitmap` constructor in `Ultima.Frame` (full trace in Root cause above). `GdipCreateBitmapFromScan0` → `NotImplemented`. ## Related findings (separate from this issue) - **`assets.bodies` MissingMethodException (new bug, worth its own issue).** During the same import: `[Bridge] assets.bodies: greatape: MissingMethodException: Default constructor not found for type Server.Mobiles.GreatApe` — same for `Navrey`, `TribeChieftan`, `TribeShaman`, `TribeWarrior`. The body→name path instantiates mobile types that have no parameterless constructor. Unrelated to GDI+; affects name resolution for those creatures. - **Sidecar permission gap:** `/opt/servuo` is `drwxr-x--- servuo servuo`, so the sidecar's `runicgateway` user cannot traverse/read `DataPath.cfg`, `/opt/servuo/uo-data` or `Cliloc.enu`. Harmless for the cliloc import (ServUO, as `servuo`, reads those and serves them over the bridge — see #37), but a latent trap worth closing, and the pre‑Nov‑22 "Permission denied (os error 13)" sidecar‑log lines should be explained. - **cliloc message does not appear in the ServUO log — expected.** `BridgeAssets.Fail` emits an `assets.error` JSON over the bridge (`BridgeLink.Emit`) and never writes to the console, so the cliloc NOT_FOUND text authored in `BridgeCliloc` travels to the website and surfaces *there*, not on the shard. The ops finding of "0 cliloc lines on the ServUO VM" is consistent with that and does **not** contradict #37. - **No CI build for this plugin** (it compiles at boot). A Linux CI runner plus deployment‑level asset tests under the real service identity would have caught this; worth its own stream. - **#37** (cliloc case‑sensitivity) is a different root cause and its fix stands.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: RunicGateway/servuo-plugins#39
No description provided.