{"record":{"id":"94b47bd522963f98","repo":"dotnet/aspnetcore","slug":"extension-types-are-not-supported","errorCode":null,"errorMessage":"Extension types are not supported","messagePattern":"Extension types are not supported","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/SignalR/clients/java/signalr/messagepack/src/main/java/com/microsoft/signalr/messagepack/MessagePackHubProtocol.java","lineNumber":633,"sourceCode":"                    if (itemType == null) {\n                        return null;\n                    }\n                    return objectMapper.readValue(payloadBytes, payload.position() + (int) readBytesStart, (int) (unpacker.getTotalReadBytes() - readBytesStart),\n                            typeFactory.constructType(itemType));\n                } else {\n                    // This is an inner call to readValue - we just need to read the right number of bytes\n                    // We can return null, and the outermost call will know how many bytes to give to objectMapper.\n                    return null;\n                }\n            case EXTENSION:\n                /*\n                ExtensionTypeHeader extension = unpacker.unpackExtensionTypeHeader();\n                byte[] extensionValue = new byte[extension.getLength()];\n                unpacker.readPayload(extensionValue);\n                //Convert this to an object?\n                item = extensionValue;\n                */\n                throw new RuntimeException(\"Extension types are not supported\");\n            default:\n                return null;\n        }\n        // If itemType was null, we were just in this method to advance the buffer. return null.\n        if (itemType == null) {\n            return null;\n        }\n        // If we get here, the item isn't a map or a collection/array, so we use the Class to cast it\n        if (itemClass.isPrimitive()) {\n            return Utils.toPrimitive(itemClass, item);\n        }\n        return itemClass.cast(item);\n    }\n\n    private void writeValue(Object o, MessagePacker packer) throws IOException {\n        packer.addPayload(objectMapper.writeValueAsBytes(o));\n    }\n}","sourceCodeStart":615,"sourceCodeEnd":651,"githubUrl":"https://github.com/dotnet/aspnetcore/blob/294cab2f9b2e03af6b953820c7ab497c3c8b7ad9/src/SignalR/clients/java/signalr/messagepack/src/main/java/com/microsoft/signalr/messagepack/MessagePackHubProtocol.java#L615-L651","documentation":"The MessagePack reader explicitly refuses EXTENSION value types — only nil/boolean/integer/float/string/binary/array/map are handled. Any extension-type byte encountered in a value triggers this throw. MessagePack extension types are used for things like timestamps and custom user types.","triggerScenarios":"A peer sends a MessagePack extension type (e.g. a timestamp ext) in a hub argument or value; a custom encoder uses extension types; jackson-datatype-jsr310 producing ext-encoded timestamps.","commonSituations":"Server serializing DateTime/OffsetDateTime as a MessagePack timestamp extension; custom MessagePack encoder on the server; sending types whose serializer emits ext codes.","solutions":["Encode timestamps/dates as ISO-8601 strings or epoch numbers instead of MessagePack ext.","Configure the server's MessagePack options to not use extension types for dates.","Avoid sending custom extension-typed values across the hub boundary."],"exampleFix":"// before: server emits DateTime as msgpack timestamp ext\n\n// after: server sends DateTime as ISO-8601 string\npublic record Dto(string timestampUtc);","handlingStrategy":"validation","validationCode":"// C# server - serialize dates as strings, not msgpack ext\npublic record Dto([property: JsonExtensionData] ... string timestampUtc);","typeGuard":null,"tryCatchPattern":"// Java\nhubConnection.start().subscribe(ok -> {}, err -> {\n    if (err.getMessage() != null && err.getMessage().contains(\"Extension types\")) {\n        // server is emitting msgpack ext (likely timestamps); switch to string dates\n    }\n});","preventionTips":["Encode dates/times as ISO-8601 strings or epoch numbers rather than MessagePack ext.","Configure the server MessagePack options to avoid extension types for dates.","Do not use custom MessagePack encoders that emit ext codes."],"tags":["signalr","messagepack","extension","datetime"],"analyzedSha":"294cab2f9b2e03af6b953820c7ab497c3c8b7ad9","analyzedAt":"2026-08-06T20:08:02.189Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}