{"record":{"id":"c88f8bd6e4fdea7d","repo":"stride3d/stride","slug":"invalid-assembly-path-doesn-t-contain-directory-information","errorCode":null,"errorMessage":"Invalid assembly path. Doesn't contain directory information","messagePattern":"Invalid assembly path\\. Doesn't contain directory information","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Design/Reflection/AssemblyContainer.cs","lineNumber":88,"sourceCode":"        }\n    }\n\n    public Assembly? LoadAssemblyFromPath(string assemblyFullPath, ILogger? outputLog = null)\n    {\n#if NET6_0_OR_GREATER\n        ArgumentNullException.ThrowIfNull(assemblyFullPath);\n#else\n        if (assemblyFullPath is null) throw new ArgumentNullException(nameof(assemblyFullPath));\n#endif\n\n        log = new LoggerResult();\n\n        assemblyFullPath = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, assemblyFullPath));\n        var assemblyDirectory = Path.GetDirectoryName(assemblyFullPath);\n\n        if (assemblyDirectory == null || !Directory.Exists(assemblyDirectory))\n        {\n            throw new ArgumentException(\"Invalid assembly path. Doesn't contain directory information\");\n        }\n\n        try\n        {\n            return LoadAssemblyFromPathInternal(assemblyFullPath);\n        }\n        finally\n        {\n            if (outputLog != null)\n            {\n                log.CopyTo(outputLog);\n            }\n        }\n    }\n\n    public bool UnloadAssembly(Assembly assembly)\n    {\n        lock (loadedAssemblies)","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Design/Reflection/AssemblyContainer.cs#L70-L106","documentation":"AssemblyContainer.LoadAssemblyFromPath resolves the given path to a full path and extracts its directory; if GetDirectoryName returns null (e.g. root-only path) or the directory does not exist on disk, it cannot set up assembly probing, so it throws an ArgumentException.","triggerScenarios":"Calling LoadAssemblyFromPath with a relative filename whose directory doesn't exist under Environment.CurrentDirectory, a path to a file in a deleted/renamed folder, or a bare root path with no directory component.","commonSituations":"Hard-coded or config-supplied plugin paths that don't exist on the target machine; copying the app without its plugin directories; case/drive-letter differences between environments; current working directory different from what relative paths assume.","solutions":["Verify the directory exists before calling: Directory.Exists(Path.GetDirectoryName(Path.GetFullPath(path))).","Pass an absolute path whose directory exists (e.g. Path.Combine(AppContext.BaseDirectory, \"plugins\", \"MyPlugin.dll\")).","Fix the configured path or deploy the missing assembly directory.","Catch ArgumentException and surface a clear configuration error to the user."],"exampleFix":"// before\ncontainer.LoadAssemblyFromPath(\"MyPlugin.dll\"); // dir may not exist\n// after\nvar path = Path.Combine(AppContext.BaseDirectory, \"plugins\", \"MyPlugin.dll\");\nif (!Directory.Exists(Path.GetDirectoryName(path))) throw new DirectoryNotFoundException(path);\ncontainer.LoadAssemblyFromPath(path);","handlingStrategy":"validation","validationCode":"var full = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, path));\nvar dir = Path.GetDirectoryName(full);\nif (string.IsNullOrEmpty(dir) || !Directory.Exists(dir)) throw new DirectoryNotFoundException($\"Assembly directory does not exist: {dir}\");\ncontainer.LoadAssemblyFromPath(full);","typeGuard":"bool IsValidAssemblyPath(string? p) { if (string.IsNullOrWhiteSpace(p)) return false; var d = Path.GetDirectoryName(Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, p))); return d != null && Directory.Exists(d); }","tryCatchPattern":"try { asm = container.LoadAssemblyFromPath(path); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"Invalid assembly path\")) { /* report bad configured path, fall back to default plugin dir */ }","preventionTips":["Use absolute paths rooted at AppContext.BaseDirectory","Verify the plugin directory exists at startup","Validate configured paths in config before loading"],"tags":["csharp","reflection","assembly-loading","path"],"backgroundTag":"directory-not-found","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"}