beeradmoore/dlss-swapper · error · Exception

Unknown AssetType

Error message

Unknown AssetType: {assetType}

What it means

GetAssetTypeName maps every known GameAssetType to a localized display name via a switch expression; the default arm throws when handed a GameAssetType value it does not recognize. This is an internal exhaustiveness guard: it means a new GameAssetType enum member was added without adding a corresponding name mapping.

Solutions

  1. Add a switch arm mapping the missing GameAssetType to its resource string (e.g. General_Name_<Type>)
  2. Update to a matching pair of library version and manifest version so enums agree
  3. Log and fall back to assetType.ToString() instead of throwing for unknown types

Example fix

// before
_ => throw new Exception($"Unknown AssetType: {assetType}"),
// after
GameAssetType.NewAsset => ResourceHelper.GetString("General_Name_NewAsset"),
_ => assetType.ToString(), // or keep throw after adding the arm
Defensive patterns

Strategy: try-catch

Validate before calling

// before calling
if (!Enum.IsDefined(typeof(GameAssetType), assetType))
    throw new ArgumentException($"Undefined GameAssetType: {assetType}");

Type guard

static bool HasKnownName(GameAssetType t) => t is GameAssetType.FSR_31_DX12 or GameAssetType.FSR_31_VK or GameAssetType.XeSS or GameAssetType.XeSS_FG or GameAssetType.XeSS_DX11 or GameAssetType.XeLL;

Try / catch

try
{
    var name = dllManager.GetAssetTypeName(assetType);
}
catch (Exception ex) when (ex.Message.StartsWith("Unknown AssetType"))
{
    name = assetType.ToString(); // fallback display
}

Prevention

When it happens

Trigger: Calling GetAssetTypeName with any GameAssetType not covered by the switch arms (e.g. a newly added enum value like a new upscaler variant, or a *_BACKUP type), including default(GameAssetType).

Common situations: Library updated to a newer version whose enum added an asset type while resource strings/mappings were not updated; deserializing a manifest containing an unknown asset type enum; casting an int into GameAssetType.

Related errors


AI-assisted analysis of beeradmoore/dlss-swapper@ab9b1e2d4b (2026-09-15). Data as JSON: /api/errors/3ebc548f65e02d07. Report an issue: GitHub.

Appendix: source

Thrown at src/Data/DLLManager.cs:786

        return individualDllPath;
    }

    public string GetAssetTypeName(GameAssetType assetType)
    {
        // NOTE: DLL type
        return assetType switch
        {
            GameAssetType.DLSS => ResourceHelper.GetString("General_Name_DLSS"),
            GameAssetType.DLSS_G => ResourceHelper.GetString("General_Name_DLSS_G"),
            GameAssetType.DLSS_D => ResourceHelper.GetString("General_Name_DLSS_D"),
            GameAssetType.FSR_31_DX12 => ResourceHelper.GetString("General_Name_FSR_31_DX12"),
            GameAssetType.FSR_31_VK => ResourceHelper.GetString("General_Name_FSR_31_VK"),
            GameAssetType.XeSS => ResourceHelper.GetString("General_Name_XeSS"),
            GameAssetType.XeSS_FG => ResourceHelper.GetString("General_Name_XeSS_FG"),
            GameAssetType.XeSS_DX11 => ResourceHelper.GetString("General_Name_XeSS_DX11"),
            GameAssetType.XeLL => ResourceHelper.GetString("General_Name_XeLL"),
            _ => throw new Exception($"Unknown AssetType: {assetType}"),
        };
    }


    public GameAssetType GetAssetBackupType(GameAssetType assetType)
    {
        // NOTE: DLL type
        return assetType switch
        {
            GameAssetType.DLSS => GameAssetType.DLSS_BACKUP,
            GameAssetType.DLSS_G => GameAssetType.DLSS_G_BACKUP,
            GameAssetType.DLSS_D => GameAssetType.DLSS_D_BACKUP,
            GameAssetType.FSR_31_DX12 => GameAssetType.FSR_31_DX12_BACKUP,
            GameAssetType.FSR_31_VK => GameAssetType.FSR_31_VK_BACKUP,
            GameAssetType.XeSS => GameAssetType.XeSS_BACKUP,
            GameAssetType.XeSS_FG => GameAssetType.XeSS_FG_BACKUP,
            GameAssetType.XeSS_DX11 => GameAssetType.XeSS_DX11_BACKUP,
            GameAssetType.XeLL => GameAssetType.XeLL_BACKUP,

View on GitHub (pinned to ab9b1e2d4b)