Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Autoupdater process spawning error arguments #2891
I was investigating an issue why after update TrayIcon was spawning hosted server even when nohosted was specified.
These are debug variable content during my debug session.
Environment.CommandLine = "D:\Projects\Duplicati\Duplicati\GUI\Duplicati.GUI.TrayIcon\bin\Debug\Duplicati.GUI.TrayIcon.exe" --no-hosted-server --read-config-from-db --server-datafolder="D:\dup\data" --accept-any-ssl-certificate
var app = D:\Projects\Duplicati\Duplicati\GUI\Duplicati.GUI.TrayIcon\bin\Debug\Duplicati.GUI.TrayIcon.exe
args after substring args = e" --no-hosted-server --read-config-from-db --server-datafolder="D:\kerbdup\data" --accept-any-ssl-certificate
Issue is clearly there, that path in commandline is quoted in double quotes, but Environment.GetCommandLineArgs().First() returns result without quotes.
Than substring returns wrong portion of string, and spawn process starts with incorrect arguments and ignore them.
Found that double quote stripping happens even in arguments:
There is one reference to this "bug"
The link has a mistake, the stripping happens from the commandline, not C#.
I can see the problem though... the