{"record":{"id":"c098c0b506dea4b9","repo":"netchx/netch","slug":"e-message-missing-file-or-runtime-components","errorCode":null,"errorMessage":"{e.Message}\n\nMissing File or runtime components","messagePattern":"(.+?)\n\nMissing File or runtime components","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"critical","filePath":"Netch/Controllers/MainController.cs","lineNumber":84,"sourceCode":"                StatusPortInfoText.Socks5Port = Socks5Server.Port;\n                StatusPortInfoText.UpdateShareLan();\n            }\n\n            // Start Mode Controller\n            Global.MainForm.StatusText(i18N.TranslateFormat(\"Starting {0}\", ModeController.Name));\n\n            await ModeController.StartAsync(Socks5Server, mode);\n        }\n        catch (Exception e)\n        {\n            releaser.Dispose();\n            await StopAsync();\n\n            switch (e)\n            {\n                case DllNotFoundException:\n                case FileNotFoundException:\n                    throw new Exception(e.Message + \"\\n\\n\" + i18N.Translate(\"Missing File or runtime components\"));\n                case MessageException:\n                    throw;\n                default:\n                    Log.Error(e, \"Unhandled Exception When Start MainController\");\n                    Utils.Utils.Open(Constants.LogFile);\n                    throw new MessageException($\"{i18N.Translate(\"Unhandled Exception\")}\\n{e.Message}\");\n            }\n        }\n    }\n\n    public static async Task StopAsync()\n    {\n        if (Lock.CurrentCount == 0)\n        {\n            (await Lock.EnterAsync()).Dispose();\n            if (ServerController == null && ModeController == null)\n                // stopped\n                return;","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/netchx/netch/blob/9d99eb1c5a2acbf2a34f2600f94242601019a300/Netch/Controllers/MainController.cs#L66-L102","documentation":"Re-thrown (as a plain Exception, not MessageException) by the MainController.StartAsync catch-all when the inner exception during startup was a DllNotFoundException or FileNotFoundException. It appends a localized 'Missing File or runtime components' hint. Because it is thrown as Exception (not MessageException), it bypasses the MessageException rethrow branch and surfaces the missing-component guidance.","triggerScenarios":"A controller Start path P/Invokes a native library (aiodns.bin, Redirector.bin, tun2socks.bin, wintun.dll) that is not present; a managed DLL dependency is missing; running on the wrong architecture so the native DllImport fails to load.","commonSituations":"Antivirus removed a bundled .dll/.bin; partial install missing the bin folder; running a 32-bit build on 64-bit Windows or vice versa; a dependent runtime (e.g. ASP.NET Core runtime for V2rayController) not installed.","solutions":["Read e.Message — it names the exact missing DLL/bin file.","Restore that file from a clean Netch release into bin\\ or the probing path.","Add an antivirus exclusion for the Netch directory.","Confirm the OS architecture matches the bundled native binaries.","Install any required runtime redistributable referenced by the controller."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Verify every native binary the controllers will P/Invoke actually exists.\nstring[] required = { \"bin\\\\aiodns.bin\", \"bin\\\\Redirector.bin\", \"bin\\\\tun2socks.bin\", \"bin\\\\wintun.dll\", \"bin\\\\nfdriver.sys\" };\nvar missing = required.Where(p => !File.Exists(Path.Combine(Global.NetchDir, p))).ToList();\nif (missing.Any())\n    throw new Exception(\"Missing runtime components: \" + string.Join(\", \", missing));","typeGuard":null,"tryCatchPattern":"try { await MainController.StartAsync(server, mode); }\ncatch (Exception ex) when (ex.Message.Contains(\"Missing File or runtime components\"))\n{\n    // ex.Message names the missing DLL/bin; offer repair/reinstall.\n    OfferRepair(ex.Message);\n}","preventionTips":["Self-check the bin directory at startup.","Add the Netch folder to antivirus exclusions to prevent DLL/bin removal.","Match the build architecture to the OS (x64 on 64-bit Windows).","Install required runtimes referenced by managed controllers."],"tags":["native-interop","file-system","dependency","startup"],"backgroundTag":null,"analyzedSha":"9d99eb1c5a2acbf2a34f2600f94242601019a300","analyzedAt":"2026-08-13T14:12:19.105Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}