{"record":{"id":"80f02f1ad316269b","repo":"abpframework/abp","slug":"could-not-get-module-types-from-assembly-assembl-80f02f","errorCode":null,"errorMessage":"Could not get module types from assembly: {assembly.FullName}","messagePattern":"Could not get module types from assembly: (.+?)","errorType":"exception","errorClass":"AbpException","httpStatus":null,"severity":"critical","filePath":"framework/src/Volo.Abp.Core/Volo/Abp/Modularity/PlugIns/FolderPlugInSource.cs","lineNumber":48,"sourceCode":"    public Type[] GetModules()\n    {\n        var modules = new List<Type>();\n\n        foreach (var assembly in GetAssemblies())\n        {\n            try\n            {\n                foreach (var type in assembly.GetTypes())\n                {\n                    if (AbpModule.IsAbpModule(type))\n                    {\n                        modules.AddIfNotContains(type);\n                    }\n                }\n            }\n            catch (Exception ex)\n            {\n                throw new AbpException(\"Could not get module types from assembly: \" + assembly.FullName, ex);\n            }\n        }\n\n        return modules.ToArray();\n    }\n\n    private List<Assembly> GetAssemblies()\n    {\n        var assemblyFiles = AssemblyHelper.GetAssemblyFiles(Folder, SearchOption);\n\n        if (Filter != null)\n        {\n            assemblyFiles = assemblyFiles.Where(Filter);\n        }\n\n        return assemblyFiles.Select(AssemblyLoadContext.Default.LoadFromAssemblyPath).ToList();\n    }\n}","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/PlugIns/FolderPlugInSource.cs#L30-L66","documentation":"Thrown by FolderPlugInSource when assembly.GetTypes() raises while scanning every assembly in a plug-in folder for module types. Identical mechanism to FilePlugInSource but triggered for an entire folder scan. Wrapped as AbpException with the offending assembly FullName and the original as InnerException.","triggerScenarios":"Configuring a plug-in folder (AddFolder / FolderPlugInSource) that contains one or more assemblies whose GetTypes() fails.","commonSituations":"A plug-in folder that also holds unrelated/third-party DLLs with broken dependencies, stale DLLs left from a previous build, or mixed target frameworks in the folder.","solutions":["Inspect ex.InnerException.LoaderExceptions to identify the broken assembly and its missing dependency.","Clean the plug-in folder so it contains only valid, compatible plug-in assemblies and their dependencies.","Use a Filter on the FolderPlugInSource to restrict which files are scanned.","Rebuild all plug-ins in the folder against the host's framework and ABP version."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Use a Filter to restrict which folder assemblies are scanned,\n// and validate each loads before scanning:\nstatic bool SafeGetTypes(Assembly a)\n{\n    try { _ = a.GetTypes(); return true; } catch { return false; }\n}","typeGuard":null,"tryCatchPattern":"try { var modules = folderSource.GetModules(); }\ncatch (AbpException ex)\n{\n    var loadEx = ex.InnerException as ReflectionTypeLoadException;\n    foreach (var le in loadEx?.LoaderExceptions ?? Array.Empty<Exception>())\n        logger.LogCritical(le, \"Folder plug-in loader error\");\n}","preventionTips":["Keep plug-in folders clean — only valid plug-in DLLs and their deps.","Apply a Filter to the FolderPlugInSource to skip unrelated files.","Rebuild all folder plug-ins together against the host's framework version."],"tags":["modularity","plugins","reflection","assembly-load","abp-core"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}