#1179·MediatR

Blazor WASM: PlatformNotSupportedException is not handled in license validation

Author: jbogardCreated Sep 24, 2026Updated Sep 24, 2026

Sub-issue of LuckyPennySoftware/AutoMapper#4659.

Problem

On Blazor WebAssembly and other client platforms, RSA isn't supported. JsonWebTokenHandler.ValidateTokenAsync returns a failed result whose Exception is SecurityTokenInvalidSignatureException (IDX10511), with a PlatformNotSupportedException caught inside it. Users get a critical-level "Error validating the Lucky Penny software license key" plus a signature error.

MediatR has no handling for this today: src/MediatR/Licensing/LicenseAccessor.cs ValidateKey doesn't catch PlatformNotSupportedException at all. AutoMapper has a catch, but it doesn't work either, because the exception isn't thrown.

Blazor WASM and client platforms account for 7 of the 26 license support cases across both products.

Fix

Match the AutoMapper fix:

  • When !validateResult.IsValid, check whether validateResult.Exception has a PlatformNotSupportedException anywhere inside it (walk InnerException, and handle AggregateException).
  • Also add a catch (PlatformNotSupportedException) around validation for platforms where it is thrown directly.
  • In both cases, log an informational message pointing to MediatR's client redistribution guidance, not LogCritical.

Tests

  • Unit test: a validation result whose exception contains a nested PlatformNotSupportedException → info-level message, and no critical log.
  • Manual: Blazor WASM sample with a license key set → friendly message only.

Generated with Claude Code

Source: LuckyPennySoftware/MediatR