{"record":{"id":"84bb4a15704f06b1","repo":"stride3d/stride","slug":"effectcompiler-returned-no-shader-and-no-compilation-error","errorCode":null,"errorMessage":"EffectCompiler returned no shader and no compilation error.","messagePattern":"EffectCompiler returned no shader and no compilation error\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Rendering/Rendering/EffectSystem.cs","lineNumber":203,"sourceCode":"            lock (cachedEffects)\n            {\n                if (!isInitialized)\n                    throw new ObjectDisposedException(nameof(EffectSystem), \"EffectSystem has been disposed. This Effect compilation has been cancelled.\");\n\n                if (effectBytecodeCompilerResult.CompilationLog.HasErrors)\n                {\n                    // Unregister result\n                    // TODO: Should we keep it so that failure never change?\n                    if (earlyCompilerCache.TryGetValue(effectName, out List<CompilerResults> effectCompilerResults))\n                    {\n                        effectCompilerResults.Remove(compilerResult);\n                    }\n                }\n\n                CheckResult(effectBytecodeCompilerResult.CompilationLog);\n\n                var bytecode = effectBytecodeCompilerResult.Bytecode\n                    ?? throw new InvalidOperationException(\"EffectCompiler returned no shader and no compilation error.\");\n\n                if (!cachedEffects.TryGetValue(bytecode, out effect))\n                {\n                    effect = new Effect(GraphicsDevice, bytecode) { Name = effectName };\n                    cachedEffects.Add(bytecode, effect);\n\n#if STRIDE_PLATFORM_DESKTOP\n                    foreach (var type in bytecode.HashSources.Keys)\n                    {\n                        var storagePath = EffectCompilerBase.GetStoragePathFromShaderType(type);\n                        if (!FileProvider.TryGetFileLocation(storagePath, out var filePath, out _, out _))\n                        {\n                            // TODO: the \"/path\" is hardcoded, used in ImportStreamCommand and ShaderSourceManager. Find a place to share this correctly.\n                            var pathUrl = storagePath + \"/path\";\n                            if (FileProvider.FileExists(pathUrl))\n                            {\n                                using var pathStream = FileProvider.OpenStream(pathUrl, VirtualFileMode.Open, VirtualFileAccess.Read);\n                                using var reader = new StreamReader(pathStream);","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Rendering/Rendering/EffectSystem.cs#L185-L221","documentation":"After CheckResult passes (no compile errors), EffectSystem asserts that the compiler returned actual shader bytecode. If EffectBytecodeCompilerResult.Bytecode is null despite a clean log, this internal invariant is violated and InvalidOperationException is thrown.","triggerScenarios":"A compiler plugin/backend returning success without producing bytecode; custom EffectCompiler implementations that forget to set Bytecode; broken compiler cache entries.","commonSituations":"Using a custom or outdated EffectCompiler pipeline (e.g. mismatched Stride compiler assemblies), or a corrupted shader cache.","solutions":["Update/reinstall the Stride compiler packages so compiler and runtime versions match.","Clear the shader cache (obj/strip, shader cache folders) and rebuild.","If a custom IEffectCompiler is used, ensure Bytecode is set on success.","File/report as a bug with the effect name if using stock Stride."],"exampleFix":"// custom compiler before\nreturn new EffectBytecodeCompilerResult { CompilationLog = log }; // Bytecode never set\n// after\nreturn new EffectBytecodeCompilerResult { Bytecode = compiledBytecode, CompilationLog = log };","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { var effect = effectSystem.LoadEffect(\"MyEffect\"); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"returned no shader\"))\n{\n    log.Error(ex, \"EffectCompiler produced no bytecode; clear shader cache and verify compiler/runtime versions\");\n}","preventionTips":["Keep Stride runtime and EffectCompiler packages at identical versions.","Clear shader cache directories when upgrading Stride.","Treat this as a bug report trigger if it reproduces with stock Stride."],"tags":["stride","effect-system","compiler","internal-invariant"],"backgroundTag":"internal-invariant-violation","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"}