{"record":{"id":"0406515371a5f73d","repo":"stride3d/stride","slug":"missing-file-provider","errorCode":null,"errorMessage":"Missing file provider.","messagePattern":"Missing file provider\\.","errorType":"exception","errorClass":"ContentStreamingException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Serialization/Streaming/ContentChunk.cs","lineNumber":86,"sourceCode":"    /// <summary>\n    /// Registers the usage operation of chunk data.\n    /// </summary>\n    public void RegisterUsage()\n    {\n        LastAccessTime = DateTime.UtcNow;\n    }\n\n    /// <summary>\n    /// Loads chunk data from the storage container.\n    /// </summary>\n    /// <param name=\"fileProvider\">Database file provider.</param>\n    public unsafe IntPtr GetData(DatabaseFileProvider fileProvider)\n    {\n        if (IsLoaded)\n            return data;\n\n        if (fileProvider == null)\n            throw new ContentStreamingException(\"Missing file provider.\", Storage);\n\n        using (var stream = fileProvider.OpenStream(Storage.Url, VirtualFileMode.Open, VirtualFileAccess.Read, VirtualFileShare.Read, StreamFlags.Seekable))\n        {\n            stream.Position = Location;\n\n#if USE_UNMANAGED\n            var chunkBytes = MemoryUtilities.Allocate(Size);\n\n            var bufferCapacity = Math.Min(8192u, (uint)Size);\n            var buffer = new byte[bufferCapacity];\n\n            var count = (uint)Size;\n            fixed (byte* bufferStart = buffer) // null if array is empty or null\n            {\n                var chunkBytesPtr = (byte*)chunkBytes;\n                do\n                {\n                    var read = (uint)stream.Read(buffer, 0, (int)Math.Min(count, bufferCapacity));","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Serialization/Streaming/ContentChunk.cs#L68-L104","documentation":"ContentChunk.GetData lazily loads chunk bytes from storage on first access and needs a DatabaseFileProvider to open the underlying file. If no provider is supplied the chunk cannot locate its Storage file, so a ContentStreamingException (with the Storage attached) is thrown.","triggerScenarios":"Calling ContentChunk.GetData(null) on a not-yet-loaded chunk; passing a provider only on some code paths (e.g. warm-up skips it).","commonSituations":"Loading content in a context where the VFS/database file provider wasn't initialized (unit tests, background threads before DatabaseSetup); refactoring that drops the fileProvider argument.","solutions":["Pass a valid DatabaseFileProvider (from the content manager's file provider) to GetData.","Ensure the content/VFS system is initialized before deserializing chunks.","Load the chunk through ContentManager APIs that wire the provider automatically."],"exampleFix":"// before\nvar ptr = chunk.GetData(null);\n// after\nvar provider = contentManager.FileProvider as DatabaseFileProvider;\nvar ptr = chunk.GetData(provider);","handlingStrategy":"validation","validationCode":"if (fileProvider == null)\n    throw new InvalidOperationException(\"GetData requires a DatabaseFileProvider; initialize the content/VFS system first.\");","typeGuard":"static bool CanLoad(ContentChunk chunk, DatabaseFileProvider p) => chunk.IsLoaded || p != null;","tryCatchPattern":"try { ptr = chunk.GetData(provider); }\ncatch (ContentStreamingException ex) {\n    logger.Error($\"Chunk load failed for {ex.Storage?.Url}: {ex.Message}\");\n}","preventionTips":["Initialize the VFS/DatabaseFileProvider before deserializing content","Never pass null providers into chunk loading","Prefer ContentManager-driven loading paths that supply the provider"],"tags":["serialization","content","vfs","null-argument"],"backgroundTag":"null-argument","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}