{"record":{"id":"3ebc548f65e02d07","repo":"beeradmoore/dlss-swapper","slug":"unknown-assettype-assettype","errorCode":null,"errorMessage":"Unknown AssetType: {assetType}","messagePattern":"Unknown AssetType: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/Data/DLLManager.cs","lineNumber":786,"sourceCode":"\n        return individualDllPath;\n    }\n\n    public string GetAssetTypeName(GameAssetType assetType)\n    {\n        // NOTE: DLL type\n        return assetType switch\n        {\n            GameAssetType.DLSS => ResourceHelper.GetString(\"General_Name_DLSS\"),\n            GameAssetType.DLSS_G => ResourceHelper.GetString(\"General_Name_DLSS_G\"),\n            GameAssetType.DLSS_D => ResourceHelper.GetString(\"General_Name_DLSS_D\"),\n            GameAssetType.FSR_31_DX12 => ResourceHelper.GetString(\"General_Name_FSR_31_DX12\"),\n            GameAssetType.FSR_31_VK => ResourceHelper.GetString(\"General_Name_FSR_31_VK\"),\n            GameAssetType.XeSS => ResourceHelper.GetString(\"General_Name_XeSS\"),\n            GameAssetType.XeSS_FG => ResourceHelper.GetString(\"General_Name_XeSS_FG\"),\n            GameAssetType.XeSS_DX11 => ResourceHelper.GetString(\"General_Name_XeSS_DX11\"),\n            GameAssetType.XeLL => ResourceHelper.GetString(\"General_Name_XeLL\"),\n            _ => throw new Exception($\"Unknown AssetType: {assetType}\"),\n        };\n    }\n\n\n    public GameAssetType GetAssetBackupType(GameAssetType assetType)\n    {\n        // NOTE: DLL type\n        return assetType switch\n        {\n            GameAssetType.DLSS => GameAssetType.DLSS_BACKUP,\n            GameAssetType.DLSS_G => GameAssetType.DLSS_G_BACKUP,\n            GameAssetType.DLSS_D => GameAssetType.DLSS_D_BACKUP,\n            GameAssetType.FSR_31_DX12 => GameAssetType.FSR_31_DX12_BACKUP,\n            GameAssetType.FSR_31_VK => GameAssetType.FSR_31_VK_BACKUP,\n            GameAssetType.XeSS => GameAssetType.XeSS_BACKUP,\n            GameAssetType.XeSS_FG => GameAssetType.XeSS_FG_BACKUP,\n            GameAssetType.XeSS_DX11 => GameAssetType.XeSS_DX11_BACKUP,\n            GameAssetType.XeLL => GameAssetType.XeLL_BACKUP,","sourceCodeStart":768,"sourceCodeEnd":804,"githubUrl":"https://github.com/beeradmoore/dlss-swapper/blob/ab9b1e2d4bb04187c48fe58eeea06c2b0ea71fbb/src/Data/DLLManager.cs#L768-L804","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Add a switch arm mapping the missing GameAssetType to its resource string (e.g. General_Name_<Type>)","Update to a matching pair of library version and manifest version so enums agree","Log and fall back to assetType.ToString() instead of throwing for unknown types"],"exampleFix":"// before\n_ => throw new Exception($\"Unknown AssetType: {assetType}\"),\n// after\nGameAssetType.NewAsset => ResourceHelper.GetString(\"General_Name_NewAsset\"),\n_ => assetType.ToString(), // or keep throw after adding the arm","handlingStrategy":"try-catch","validationCode":"// before calling\nif (!Enum.IsDefined(typeof(GameAssetType), assetType))\n    throw new ArgumentException($\"Undefined GameAssetType: {assetType}\");","typeGuard":"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;","tryCatchPattern":"try\n{\n    var name = dllManager.GetAssetTypeName(assetType);\n}\ncatch (Exception ex) when (ex.Message.StartsWith(\"Unknown AssetType\"))\n{\n    name = assetType.ToString(); // fallback display\n}","preventionTips":["Add a resource string + switch arm whenever GameAssetType gains a member","Write an enum-exhaustiveness test iterating all GameAssetType values","Avoid casting raw ints to GameAssetType from external data without validation"],"tags":["enum","mapping","dotnet"],"backgroundTag":"unsupported-enum-value","analyzedSha":"ab9b1e2d4bb04187c48fe58eeea06c2b0ea71fbb","analyzedAt":"2026-09-15T05:25:32.979Z","contentChangedAt":"2026-09-15T05:25:32.979Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}