locked
Debugger Freeze or Crash RRS feed

  • Question

  • We are developing an application for a ConnectCore i.MX51 Wi-i.MX51 ARM device using Embedded Compact 7 and compact framework 3.5. We started noticing that we were no longer able to hit breakpionts while remotely debugging because the debugger would freeze and/or terminate the connection as soon as a target breakpoint was hit. We eventually figured out that this was because we were loading ~32 MB onto the heap and once that threshold is crossed the debugger no longer functions even if the garbage collector removes the memory after the objects go out of scope. We created a simple program shown below that proves this concept. The application runs perfectly fine but we just lose the capacity to debug. Has anyone encountered this issue before and/or know a solution?

    Example Program that causes breakpoint crash.

    using System;
    using System.Linq;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;

    namespace SmartDeviceProject1
    {
        public partial class Form1 : Form
        {
            Dictionary<string, Bitmap> myDictionary = new Dictionary<string, Bitmap>();
            Dictionary<string, byte[]> testArr = new Dictionary<string, byte[]>();

            public Form1()
            {

                testSmallByteFunc();
                InitializeComponent();
               
                /*Clear Test */
                //testArr.Clear();
                //GC.Collect();
                //GC.WaitForPendingFinalizers();

            }


            private void testLargeByteFunc()
            {
                for (int i = 0; i < 1 ; i++)
                {
                    //Changing this to 30000000 will make beakpoint work.
                    byte[] by = new byte[32000000];
                    testArr.Add(i.ToString(), by);
                }
               
            }

            private void testSmallByteFunc()
            {
                for (int i = 0; i < 32000; i++)
                {
                    byte[] by = new byte[1000];
                    testArr.Add(i.ToString(), by);
                }

            }

            private void button1_Click(object sender, EventArgs e)
            {
                // Break Point here will cause debugger to freeze/or
                //crash
                int x = 3;
            }
        }
    }

     

    Wednesday, November 23, 2011 6:39 PM

Answers

  • There is actually a hotfix that we found for this issue that did resolve our problem.

     

    http://support.microsoft.com/kb/973905

     

    • Marked as answer by Jesse Jiang Tuesday, November 29, 2011 7:27 AM
    Monday, November 28, 2011 5:08 PM

All replies

  • We are using

     

    Visual Studio 2008 Version 9.0.3079.1 SP

    .Net Framework Version 3.5 SP1

    Wednesday, November 23, 2011 6:41 PM
  • Hello,

     

    I'm so sorry for that it is system limit, and it will be hard to overcome it. I would suggest you to write logs to instead of debugging.

     

    Best regards,

    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    • Edited by Jesse Jiang Friday, November 25, 2011 7:00 AM
    Friday, November 25, 2011 6:59 AM
  • Thank you Jesse, looks like we will have to make do with the logging.
    • Edited by sdangelo83 Friday, November 25, 2011 5:31 PM
    Friday, November 25, 2011 5:30 PM
  • There is actually a hotfix that we found for this issue that did resolve our problem.

     

    http://support.microsoft.com/kb/973905

     

    • Marked as answer by Jesse Jiang Tuesday, November 29, 2011 7:27 AM
    Monday, November 28, 2011 5:08 PM
  • Thanks for sharing the solution.

     

    Best regards,

    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us
    Tuesday, November 29, 2011 7:27 AM
  • Anyone reading this should know that the hotfix doesn't actually need
    to be applied to WEC7, as the CF DLLs already contain the fix. All that
    needs to be added is a registry DWORD under
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETCompactFramework called
    JITCodeBufferSizeLimitEnabled with the value of 1. It doesn't seem very
    intuitive, as that implies you're introducing the limit, but it works.

    Chris Chambers.

    • Proposed as answer by CPAJChambers Tuesday, August 7, 2012 3:24 PM
    Tuesday, August 7, 2012 3:24 PM