{"record":{"id":"ee02ac37d693b29d","repo":"unoplatform/uno","slug":"type-compile-failed-infolog-ee02ac","errorCode":null,"errorMessage":"{type} compile failed: {infoLog}","messagePattern":"(.+?) compile failed: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"critical","filePath":"src/SamplesApp/SamplesApp.Samples/Windows_UI_Composition/PostProcessGlCanvasElement.cs","lineNumber":230,"sourceCode":"\t\t\t{\n\t\t\t\tthrow new Exception(\"Program link failed: \" + gl.GetProgramInfoLog(prog));\n\t\t\t}\n\t\t\tgl.DetachShader(prog, vs);\n\t\t\tgl.DetachShader(prog, fs);\n\t\t\tgl.DeleteShader(vs);\n\t\t\tgl.DeleteShader(fs);\n\t\t\treturn prog;\n\t\t}\n\n\t\tprivate static uint CompileShader(GL gl, ShaderType type, string source)\n\t\t{\n\t\t\tvar sh = gl.CreateShader(type);\n\t\t\tgl.ShaderSource(sh, source);\n\t\t\tgl.CompileShader(sh);\n\t\t\tgl.GetShader(sh, ShaderParameterName.CompileStatus, out int status);\n\t\t\tif (status != (int)GLEnum.True)\n\t\t\t{\n\t\t\t\tthrow new Exception($\"{type} compile failed: \" + gl.GetShaderInfoLog(sh));\n\t\t\t}\n\t\t\treturn sh;\n\t\t}\n\t}\n}\n#endif\n","sourceCodeStart":212,"sourceCodeEnd":237,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SamplesApp/SamplesApp.Samples/Windows_UI_Composition/PostProcessGlCanvasElement.cs#L212-L237","documentation":"CompileShader in PostProcessGlCanvasElement throws when a stage fails to compile, before the program is linked (error 86). The info log is appended. Applies to both the scene vertex/fragment sources and the post-process vertex/fragment sources.","triggerScenarios":"Inside CompileShader after gl.CreateShader + ShaderSource + CompileShader, gl.GetShader(CompileStatus) != True (lines 223-230). The scene fragment shader uses `in vec3 vColor; out vec4 fragColor;` and the post fragment shader uses sine-wave displacement and samples uTex.","commonSituations":"versionDef picked the wrong GLSL profile for the running context (desktop `#version 330` on a GLES context); `precision highp float` rejected on the vertex stage of a low-end context; layout(location=0) qualifiers unsupported on GLSL ES 1.00; a typo in the displacement math (e.g. an undeclared identifier); the sine `mat2 rot = mat2(c, -s, s, c)` construct rejected on a context that lacks the constructor overload.","solutions":["Read the appended infoLog which contains the GLSL compiler's line-number diagnostics.","Print gl.GetStringS(StringName.ShadingLanguageVersion) and confirm the versionDef matches (the sample already does this check at lines 99-102 — verify it ran before the throw).","For WebGL1/GLES2 contexts, fall back to GLSL ES 1.00 syntax: replace in/out with attribute/varying, gl_FragData[0] or gl_FragColor, and drop layout qualifiers.","Run the shader source through an offline glslangValidator to catch syntax before runtime.","If `precision highp float` is the offender on the vertex stage, move precision declarations to the fragment stage only or downgrade to mediump."],"exampleFix":"// before\nif (status != (int)GLEnum.True)\n    throw new Exception($\"{type} compile failed: \" + gl.GetShaderInfoLog(sh));\n\n// after — include the offending source with line numbers\nif (status != (int)GLEnum.True)\n{\n    var log = gl.GetShaderInfoLog(sh);\n    var src = string.Join('\\n', source.Split('\\n').Select((l, i) => $\"{i+1,3}: {l}\"));\n    throw new Exception($\"{type} compile failed: {log}\\n{src}\");\n}","handlingStrategy":"validation","validationCode":"var sl = gl.GetStringS(StringName.ShadingLanguageVersion);\nvar gles = sl.Contains(\"OpenGL ES\", StringComparison.OrdinalIgnoreCase);\nif (gles && !sl.Contains(\"3.\")) return; // #version 300 es not supported\nif (!source.StartsWith(gles ? \"#version 300 es\" : \"#version 330\")) return;","typeGuard":null,"tryCatchPattern":"try { sh = CompileShader(gl, type, source); }\ncatch (Exception ex) when (ex.Message.Contains(\"compile failed\"))\n{\n    App.MainWindow?.LogError($\"{type} compile failed (PostProcess): {ex.Message}\");\n    sh = 0;\n}","preventionTips":["Pick the #version directive from ShadingLanguageVersion.","Drop `precision highp float` from the vertex stage on contexts that reject it.","Use GLSL ES 1.00 for WebGL1/GLES2.","Validate offline with glslangValidator."],"tags":["opengl","silk-net","glsl","shader-compile","shader"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}