0

I'm developing an application that targets Windows Mobile 6 using Visual Studio 2008. The development itself is pretty easy, but I'm realizing how much I rely on Edit-And-Continue in VB.NET when I'm doing regular development. The mobile device emulator (and the device itself) doesn't seem to support edit-and-continue, meaning that I have to compile my application, deploy it to the emulator, fire it up and get to the point I'm working with (takes a minute or two, sometimes), and then step through the code to see what's going on. While I can change variable values on the fly, I can't update any code - to do that, I have to stop execution, make the code change, and repeat the process.

It leads to very slow development (I can hear the old-timers say "That's how everything was in our day! Read before you compile!), and I'm wondering if there's a way to make it a bit less painful. I'm trying to develop larger pieces of code at once so the debugging comes only in painful spurts, but it's still a very frustrating experience when I call the wrong property or attach to the incorrect event, and then I have to start over after making a one-line change.

I'd considered developing a Windows forms application at the same time, naming all the form objects the same, and then sharing the back-end code between the two. That way, I could compile, work out bugs, do edit-and-continue, on the Winforms app, and then just copy the code to my mobile application once it's vetted. Is there a better idea?

SqlRyan
  • 33,116
  • 33
  • 114
  • 199

2 Answers2

0

This is exactly why I use lots of interfaces, good view/model separation and reliance on software services. Much of my development is done either in a desktop Unit Test, or in small "shim" apps that run on the device without having to deploy and spin up the entire app.

Basically most of my projects have both a desktop and a device project, and I do most functional work on the desktop. I only move to the device when I need to wire up UI and that sort of thing. I don't (or very rarely anyway) create desktop UI to mock up the device UI - if you're doing that it indicates the UI is too coupled with the business logic.

ctacke
  • 66,480
  • 18
  • 94
  • 155
0

Deploy to the Emulator, instead of the device.

Before you distribute your application, test on the device, though!

The emulator will allow you to step through your code, edit values running in memory, and write changes to the code as you go.

Note that any changes you make to the code will not be executed until you stop the debugger and recompile, just like a real device. However, those changes will be there for the next time you run your code.

Lots of breakpoints.

If you have lots of threads, breakpoints are going to be irritating.

  • I'm able to do the same "edit without code applying to the run time" even against real hardware. – ctacke Feb 06 '13 at 14:56
  • @ctacke I wonder what I'm missing then, because my code is locked when the debugger is attached, even when it's on the emulator. Though it would be ideal to be able to edit the actual running code (as jp2code suggests you can do, but which I'm not able to), I'd settle for just being able to make changes that don't apply (like I'll notice a spelling error, or want to add a comment, or something else, but I'm unable to make those changes while debugging). – SqlRyan Feb 06 '13 at 19:18
  • Hey Ryan, I noticed that if I include any sort of LINQ queries in my code (i.e. `foreach (var x in list.Where(a => a.Property == value)) { ... }`), then my debugger will complain on any edits saying I have to recompile. Do you have any LINQ queries in your code? –  Feb 06 '13 at 21:27
  • No the code is definitely not locked. And yes, any change that requires a LINQ re-evaluation won't work - it forces a restart at that point. – ctacke Feb 06 '13 at 21:45
  • @ctacke Am I missing something? I run with debugging, deployed to the emulator, and when I attempt to edit the source code, I get "Cannot currently modify this text in the editor. It is read-only." It seems I'm not able to modify it. – SqlRyan Feb 12 '13 at 20:04