Remote debug on Rpi2 and saved data

When we develop with our dear Visual Studio 2015 and we try to debug our solution on Raspberry Pi, sometime we have settings, images, files, database in our software. We want set up at the first time and normally when we start the debug we don’t want to reload all each time.

To avoid loosing our files or database each time we start a new debug, in the properties of the project (right click on the root of the project and choose properties) there is a checkbox to allow Visual Studio 2015 to keep our settings data.

Keep_1

but in my case it doesn’t work and I don’t know why.

There is another option to tke a look: upper in the same property page, there is another checkbox

keep_2

This checkbox must be unchecked. Obviously, it allows Visual Studio to delete the installed package and reinstall it. In this case we loose our data.

In any case I’ve loose my data… what I have to do? A friend of mine sayd “Pass to develop on Linux” but… I don’t think so 😀

Ok, after some days of fighting I’ve found a solution:

  1. start with debugging mode our application on RPi
  2. load/create our settings
  3. shut down the application

Up to this point no problem, it’s normal as we made. But now no we take another approach. Now if we want to debug our application we can’t run directly from Visual Studio without loose our settings. But on PRi there is already the remote debug running and we can deploy our modified solution withour overwrite settings and custom data. How? Ok, I explain:

  1. right click on project root in Solution Explorer
  2. choose Deploy

if you have rightly set the parameters to connect to your RPi, everything will be all right. Your modifies solution will be deployed.

Now we have to debug it. From menu Debug choose “Debug other Targets” and then “Debug installed App packages”

a window will appear

in the first combobox choose “Remote Machine”. The remote connection box will appear to choose the connection to your RPi

keep_4a

And now choose from list your application and push the button “Start” in the lower-right corner and your application will starts attached to your debugger! WoW!!! 😀

Sometime the connection box doesn’t show our RPi in the lower part of the window. We can try to enter manually the phisic address of our RPi. and press “Select” but sometime doesn’t work. The reason is thar RPi is not able to run the remote debugger. In this case we have to run it manually.

keep_4

How can we do that? Simply! Connect to RPi with your browser, choose the IoTOnboardingTask application and run it if not running yet.

Enjoy!