How to run from Visual Studio with debugger?

Hi

I’m new to Duplicati and want to debug a few issues.
Which project do I have to start, to run Duplicati from VS?

Hello and welcome to the forum!

I have found that you need to set AUTOUPDATER_Duplicati_SKIP_UPDATE=1 environment variable or realtime debugging doesn’t work.

I assume you’ve already cloned the git repo to your local machine. In VS, open the Duplicati.sln file. Set your startup project to Duplicati.GUI.TrayIcon and then just click Start. Note that when running in Debug mode Duplicati will place its databases in a different location so as not to interfere with Duplicati that may be installed on the local machine.

Hope this helps…

1 Like

Thanks for the quick reply.
I tried setting the AUTOUPDATER…, but I’m still getting the “The breakpoint will not currently be hit no symbols have been loaded for this document”.

The usual fixes doesn’t seem to work, so I’m a bit stuck?

I’m trying to debug Duplicati.Library.Main.Operation.RestoreHandler.PatchWithBlocklist (…).

Make sure you restart Visual Studio after setting that environment variable. By the way - you are running the Debug profile, right? Not Release?

1

Yes. I rebooted and ran “SET AUTOUPDATER_Duplicati_SKIP_UPDATE=1” from cmd, before launching VS (current duplicati-master).
I’m launching in DEBUG mode.

That won’t work - if you run it from a cmd prompt it will only affect that process and its child processes. (So if you start Visual Studio from a desktop icon, it won’t be affected.)

Instead go to System Properties, Advanced, and click Environment Variables. Put the variable and value there and press OK. Confirm it works by starting a NEW cmd session and typing SET AUTO and you should see AUTOUPDATER_Duplicati_SKIP_UPDATE=1 listed.

Then start VS and try again. :slight_smile:
Good luck!

1 Like

That fixed it.

I have added the solution to the Wiki:

1 Like

I haven’t had to set any environment variables when debugging on Linux. Is this specific to Windows? The below line looks relevant:

Looks like it might be. What dev tool do you use on Linux?

I mainly use Rider, but occasionally use Monodevelop.

The general problem is that the autoupdater spawns a new executable and runs that. The debugger only controls the entry process (which does nothing but wait for the spawned process to quit). This quirk is required as it is otherwise not possible to unload all assemblies and reload the updated ones.

Disabling the autoupdater fixes this, by breaking the autoupdate feature, and then just running everything from the entry process.

The line with Windows, is just forwarding the console input/output from the spawned process to the parent process, such that a Windows commandline user can see the output from the spawned child.