On Windows CE 6.0 R2 and later there is a bug which can manifest itself when debugging through Visual Studio which causes the application to crash and break the connection to the debugger. This is more likely to happen with a XAML project as the UI framework is more complex than Windows Forms. There is a Hotfix available for CE 6.0 R2, the fix is included in CE 6.0 R3 and Compact 7 but still requires a registry change to take effect.
Unfortunately the description on the article page is a little misleading. The registry setting affects the buffer available for JITted code and not the application memory. You should find that setting this value to 1 will resolve the crashing issue and allow you to debug normally. The setting should not be required when running your application in release mode.