Prefetch Abort Exception on WinCE 7 while debugging in VS2008


Has anyone seen a 'Prefetch Abort' exception while stepping thru code in debug mode in VS 2008? This occurs with an MK3190 (MPA 3.0; OS is WEC 7) connected to a Windows 7 PC, running VS 2008 with EMDK 2.7 installed and the Motorola Patch 1 for the EMDK 2.7 also installed. The customer application is written in VB .NET. The error occurs only in Debug mode while stepping thru the code.
Installing below MS patch did not resolve the issue either:
Any pointers would be greatly appreciated! Thanks.

Submitted by TXC736 on January 09, 2013 Permalink

Changing a reg key on the device resolved the issue. Turns out WinCE 6 and 7 (both use.NET CF 3.5) limit the stack to grow only up to 32MB in debug mode unless the reg key is changed explicitly. See MS article below:

Managed application crashes with debugger attached on ARMv7
If your managed application consumes more than 32MB on an ARMv7 platform you may run in to problems when debugging with your application crashing. Typically the application runs fine when launched on the device, but when launched from the Visual Studio debugger the application will crash as soon as the stack consumption goes above 32MB. This hotfix describes the problem better than I can:   You do not need to apply the hotfix to WEC7 as PB will have already placed the fixed .netCF assemblies on to your image, however you will need to add the registry value to activate the fix:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETCompactFramework]  "JITCodeBufferSizeLimitEnabled"=dword:1

Below is another VS 2008 patch that might come in handy also. But the above registry fix alone solved the issue for us.