{"record":{"id":"7000d550577af19e","repo":"unoplatform/uno","slug":"program-link-failed-infolog-7000d5","errorCode":null,"errorMessage":"Program link failed: {infoLog}","messagePattern":"Program link failed: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"critical","filePath":"src/SamplesApp/SamplesApp.Samples/Windows_UI_Composition/PostProcessGlCanvasElement.cs","lineNumber":213,"sourceCode":"\t\t\tgl.Uniform1(_postUTimeLoc, t);\n\t\t\tgl.BindVertexArray(_postVao);\n\t\t\tgl.DrawArrays(PrimitiveType.Triangles, 0, 6);\n\n\t\t\tInvalidate();\n\t\t}\n\n\t\tprivate static uint CreateProgram(GL gl, string vertexSource, string fragmentSource)\n\t\t{\n\t\t\tvar vs = CompileShader(gl, ShaderType.VertexShader, vertexSource);\n\t\t\tvar fs = CompileShader(gl, ShaderType.FragmentShader, fragmentSource);\n\t\t\tvar prog = gl.CreateProgram();\n\t\t\tgl.AttachShader(prog, vs);\n\t\t\tgl.AttachShader(prog, fs);\n\t\t\tgl.LinkProgram(prog);\n\t\t\tgl.GetProgram(prog, ProgramPropertyARB.LinkStatus, out int linkStatus);\n\t\t\tif (linkStatus != (int)GLEnum.True)\n\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}","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SamplesApp/SamplesApp.Samples/Windows_UI_Composition/PostProcessGlCanvasElement.cs#L195-L231","documentation":"CreateProgram in PostProcessGlCanvasElement links the scene and post-process shader pairs and throws when the link status is not True. Identical mechanism to error 83 but applies to the two programs that drive the rotating-triangle scene pass and the displacement-sampling post pass.","triggerScenarios":"After AttachShader(vertex) + AttachShader(fragment) + LinkProgram for either _sceneProgram (aPos/aColor in, uTime uniform, vColor out) or _postProgram (aPos/aUV in, uTex sampler + uTime uniform, vUV out). GetProgram(LinkStatus) != True (lines 210-213).","commonSituations":"The scene vertex shader outputs `out vec3 vColor` while the fragment declares `in vec3 vColor` — a type/name mismatch link-fails; the post fragment shader declares `uniform sampler2D uTex` but the sampler's texture unit binding is invalid in the current context (link-time, not run-time, if the sampler count exceeds limits); versionDef mismatch between stages; both programs share the same attribute locations which is fine individually but a per-program link fails if layout(location) qualifiers collide with built-in attribs on some drivers.","solutions":["Read the appended GetProgramInfoLog output — it names the unresolved varying or the exceeded limit.","Verify the vertex `out` and fragment `in` blocks match exactly (name, type, qualifier) for the failing program.","Confirm both stages use the same versionDef so the GLSL profiles match.","Check that the number of active samplers (here just uTex, one) is within MAX_TEXTURE_IMAGE_UNITS.","Link one program at a time and isolate which of _sceneProgram / _postProgram fails to localize the interface mismatch."],"exampleFix":"// before\nif (linkStatus != (int)GLEnum.True)\n    throw new Exception(\"Program link failed: \" + gl.GetProgramInfoLog(prog));\n\n// after — tag which program (scene vs post) failed\nif (linkStatus != (int)GLEnum.True)\n    throw new Exception($\"Program link failed [vs={Path.GetFileName(vertexSource.GetHashCode().ToString())}]: {gl.GetProgramInfoLog(prog)}\");","handlingStrategy":"validation","validationCode":"// Confirm both stages share the versionDef and that varyings match\nif (!vertexSource.StartsWith(versionDef) || !fragmentSource.StartsWith(versionDef)) return;\n// Pre-link: bind attrib locations explicitly to avoid collisions\ngl.BindAttribLocation(prog, 0, \"aPos\");\ngl.BindAttribLocation(prog, 1, \"aColor\"); // or aUV","typeGuard":null,"tryCatchPattern":"try { _sceneProgram = CreateProgram(gl, sceneVs, sceneFs); }\ncatch (Exception ex) when (ex.Message.Contains(\"Program link failed\"))\n{\n    App.MainWindow?.LogError($\"Scene program link failed: {ex.Message}\");\n    _sceneProgram = 0;\n}","preventionTips":["Match vertex `out` and fragment `in` declarations exactly.","Use the same GLSL profile across both stages.","Stay within MAX_VERTEX_ATTRIBS and MAX_TEXTURE_IMAGE_UNITS.","Link one program at a time to localize interface mismatches."],"tags":["opengl","silk-net","glsl","shader-link","shader-program"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}