{"record":{"id":"47bc3eafcee214c2","repo":"microsoft/semantic-kernel","slug":"s-namespace-name-assembly-not-found","errorCode":null,"errorMessage":"[{s_namespace}] {name} assembly not found","messagePattern":"\\[(.+?)\\] (.+?) assembly not found","errorType":"exception","errorClass":"KernelException","httpStatus":null,"severity":"critical","filePath":"dotnet/src/Experimental/Orchestration.Flow/EmbeddedResource.cs","lineNumber":15,"sourceCode":"﻿// Copyright (c) Microsoft. All rights reserved.\n\nusing System.IO;\nusing System.Reflection;\n\nnamespace Microsoft.SemanticKernel.Experimental.Orchestration;\n\ninternal static class EmbeddedResource\n{\n    private static readonly string? s_namespace = typeof(EmbeddedResource).Namespace;\n\n    internal static string? Read(string name, bool throwIfNotFound = true)\n    {\n        var assembly = typeof(EmbeddedResource).GetTypeInfo().Assembly ??\n            throw new KernelException($\"[{s_namespace}] {name} assembly not found\");\n\n        using Stream? resource = assembly.GetManifestResourceStream($\"{s_namespace}.\" + name);\n        if (resource is null)\n        {\n            if (!throwIfNotFound)\n            {\n                return null;\n            }\n\n            throw new KernelException($\"[{s_namespace}] {name} resource not found\");\n        }\n\n        using var reader = new StreamReader(resource);\n        return reader.ReadToEnd();\n    }\n}\n","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Experimental/Orchestration.Flow/EmbeddedResource.cs#L1-L32","documentation":"EmbeddedResource.Read calls typeof(EmbeddedResource).GetTypeInfo().Assembly to load embedded prompt/resource files bundled with the Orchestration.Flow experimental assembly. If that Assembly property returns null — a near-impossible condition under normal .NET runtime behavior — KernelException is thrown. This is effectively a runtime-environment failure, not a usage error.","triggerScenarios":"The CLR returns null for the assembly containing the EmbeddedResource type. This would require a severely broken assembly-load context, a stripped/obfuscated binary, or a reflection-only/unsupported hosting scenario.","commonSituations":"Running in a constrained or non-standard host (e.g., AOT with trimming that strips assembly metadata, a broken custom assembly resolver, or a corrupted deployment). This error is not expected in normal application usage.","solutions":["Verify the assembly is not being trimmed or obfuscated in a way that strips GetType().Assembly.","If using Native AOT / trimming, ensure the Orchestration.Flow assembly and its resources are preserved.","Re-deploy the application from a clean build to rule out corruption.","If this reproduces, report it as a runtime/hosting-environment issue rather than a code bug."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Not preventable via pre-call validation — it's a runtime condition.\n// At startup, sanity-check that the assembly loads correctly:\nvar asm = typeof(EmbeddedResource).GetTypeInfo().Assembly;\nif (asm is null)\n    throw new InvalidOperationException(\"Runtime cannot resolve the Orchestration.Flow assembly.\");","typeGuard":null,"tryCatchPattern":"try { var content = EmbeddedResource.Read(\"prompts/config.txt\"); }\ncatch (KernelException ex) when (ex.Message.Contains(\"assembly not found\"))\n{\n    logger.LogCritical(ex, \"Runtime environment cannot resolve the assembly. Possible trimming/AOT issue.\");\n    throw;\n}","preventionTips":["If using Native AOT or IL trimming, add a DynamicDependency or rd.xml to preserve the assembly.","Test resource loading in the production host environment, not just in dev.","Do not obfuscate or strip the Orchestration.Flow assembly."],"tags":["embedded-resource","assembly","runtime","aot","experimental"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}