{"record":{"id":"868258fd06a5b750","repo":"stride3d/stride","slug":"stream","errorCode":null,"errorMessage":"stream","messagePattern":"stream","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Yaml/Serialization/Serializer.cs","lineNumber":255,"sourceCode":"        /// </summary>\n        /// <param name=\"reader\">The reader.</param>\n        /// <returns>A deserialized object.</returns>\n        public object Deserialize(TextReader reader)\n        {\n            return Deserialize(reader, null);\n        }\n\n        /// <summary>\n        /// Deserializes an object from the specified <see cref=\"Stream\" /> with an expected specific type.\n        /// </summary>\n        /// <param name=\"stream\">The stream.</param>\n        /// <param name=\"expectedType\">The expected type.</param>\n        /// <param name=\"contextSettings\">The context settings.</param>\n        /// <returns>A deserialized object.</returns>\n        /// <exception cref=\"System.ArgumentNullException\">stream</exception>\n        public object Deserialize(Stream stream, Type expectedType, SerializerContextSettings contextSettings = null)\n        {\n            if (stream == null) throw new ArgumentNullException(nameof(stream));\n\n            return Deserialize(new StreamReader(stream), expectedType, null, contextSettings);\n        }\n\n        /// <summary>\n        /// Deserializes an object from the specified <see cref=\"Stream\" /> with an expected specific type.\n        /// </summary>\n        /// <param name=\"stream\">The stream.</param>\n        /// <param name=\"expectedType\">The expected type.</param>\n        /// <param name=\"contextSettings\">The context settings.</param>\n        /// <param name=\"context\">The context used to deserialize this object.</param>\n        /// <returns>A deserialized object.</returns>\n        /// <exception cref=\"System.ArgumentNullException\">stream</exception>\n        public object Deserialize(Stream stream, Type expectedType, SerializerContextSettings contextSettings, out SerializerContext context)\n        {\n            if (stream == null) throw new ArgumentNullException(nameof(stream));\n\n            return Deserialize(new StreamReader(stream), expectedType, null, contextSettings, out context);","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Yaml/Serialization/Serializer.cs#L237-L273","documentation":"Serializer.Deserialize(Stream, Type, ...) guards its input with a null check and throws ArgumentNullException when the stream parameter is null. It is a plain validation guard: the caller passed a null Stream, so there is nothing to deserialize.","triggerScenarios":"Calling Deserialize(null, expectedType) — a stream returned null from config lookup, a File.OpenRead failure swallowed upstream, or a lazily-initialized field never assigned.","commonSituations":"Reading assets/config where an optional file is absent and the stream variable stays null; factory methods returning null stream on error instead of throwing.","solutions":["Pass a valid opened Stream (e.g. File.OpenRead(path)) to Deserialize","Check stream for null before calling and raise a file-specific error with the path","Use the string/TextReader overloads when the content is already in memory","Ensure asset-loading helpers throw on failure instead of returning null streams"],"exampleFix":"// before\nvar obj = serializer.Deserialize(stream, typeof(Config)); // stream == null\n// after\nusing var stream = File.OpenRead(path);\nvar obj = serializer.Deserialize(stream, typeof(Config));","handlingStrategy":"type-guard","validationCode":"if (stream is null) throw new FileNotFoundException(\"Input stream for deserialization is missing\");","typeGuard":"static bool IsReadable(Stream s) => s != null && s.CanRead;","tryCatchPattern":"try { return serializer.Deserialize(stream, expectedType); }\ncatch (ArgumentNullException ex) when (ex.ParamName == \"stream\") { throw new InvalidOperationException(\"Stream was not opened before deserialization\", ex); }","preventionTips":["Open streams with using statements right before deserializing","Have loaders throw on failure instead of returning null streams","Prefer file-path overloads that surface missing-file errors","Assert stream.CanRead in tests around deserialization"],"tags":["argument-null","deserialization","stream"],"backgroundTag":"null-argument","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}