netchx/netch · critical · Exception

{e.Message} Missing File or runtime components

Error message

{e.Message}

Missing File or runtime components

What it means

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.

Source

Thrown at Netch/Controllers/MainController.cs:84

                StatusPortInfoText.Socks5Port = Socks5Server.Port;
                StatusPortInfoText.UpdateShareLan();
            }

            // Start Mode Controller
            Global.MainForm.StatusText(i18N.TranslateFormat("Starting {0}", ModeController.Name));

            await ModeController.StartAsync(Socks5Server, mode);
        }
        catch (Exception e)
        {
            releaser.Dispose();
            await StopAsync();

            switch (e)
            {
                case DllNotFoundException:
                case FileNotFoundException:
                    throw new Exception(e.Message + "\n\n" + i18N.Translate("Missing File or runtime components"));
                case MessageException:
                    throw;
                default:
                    Log.Error(e, "Unhandled Exception When Start MainController");
                    Utils.Utils.Open(Constants.LogFile);
                    throw new MessageException($"{i18N.Translate("Unhandled Exception")}\n{e.Message}");
            }
        }
    }

    public static async Task StopAsync()
    {
        if (Lock.CurrentCount == 0)
        {
            (await Lock.EnterAsync()).Dispose();
            if (ServerController == null && ModeController == null)
                // stopped
                return;

View on GitHub (pinned to 9d99eb1c5a)

Solutions

  1. Read e.Message — it names the exact missing DLL/bin file.
  2. Restore that file from a clean Netch release into bin\ or the probing path.
  3. Add an antivirus exclusion for the Netch directory.
  4. Confirm the OS architecture matches the bundled native binaries.
  5. Install any required runtime redistributable referenced by the controller.
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify every native binary the controllers will P/Invoke actually exists.
string[] required = { "bin\\aiodns.bin", "bin\\Redirector.bin", "bin\\tun2socks.bin", "bin\\wintun.dll", "bin\\nfdriver.sys" };
var missing = required.Where(p => !File.Exists(Path.Combine(Global.NetchDir, p))).ToList();
if (missing.Any())
    throw new Exception("Missing runtime components: " + string.Join(", ", missing));

Try / catch

try { await MainController.StartAsync(server, mode); }
catch (Exception ex) when (ex.Message.Contains("Missing File or runtime components"))
{
    // ex.Message names the missing DLL/bin; offer repair/reinstall.
    OfferRepair(ex.Message);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of netchx/netch@9d99eb1c5a (2026-08-13). Data as JSON: /api/errors/c098c0b506dea4b9. Report an issue: GitHub.