Skip to content

Doorstop does not initialize when game process spawns itself/restarts itself #73

@TerameTechYT

Description

@TerameTechYT

I have worked on a BepInEx plugin that automatically updates itself, and user is given a restart prompt. When you call Process.Start on the running game, it will inherit the environment variables from the running process for the newly spawned process, causing Doorstop to not initalize properly in the new process.

(i know #34 exists)

I have found a workaround for anyone else that has this issue

var startInfo = new ProcessStartInfo();
startInfo.FileName = Paths.ExecutablePath;
startInfo.WorkingDirectory = Paths.GameRootPath;
startInfo.UseShellExecute = false;

// remove environment variables that new process will inherit
startInfo.Environment.Remove("DOORSTOP_INITIALIZED");
startInfo.Environment.Remove("DOORSTOP_DISABLE");

Process.Start(startInfo);

Application.Quit();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions