Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Visual Studio调试断点冻结应用程序_C#_Visual Studio 2010_Debugging - Fatal编程技术网

C# Visual Studio调试断点冻结应用程序

C# Visual Studio调试断点冻结应用程序,c#,visual-studio-2010,debugging,C#,Visual Studio 2010,Debugging,我在我的代码中添加了几个断点,以便在到达时监视两个变量的值。该应用程序基本上从工作频率为500 Hz的微控制器生成的串行端口接收9600波特的数据流,并且必须根据某些规则“if”和“if-else”过滤消息,以去除标题字符并将其寻址到其他变量以供计算使用。 代码如下: class Stripper { public void Distri (string inComing, out string param1, out string param2, out string param3,

我在我的代码中添加了几个断点,以便在到达时监视两个变量的值。该应用程序基本上从工作频率为500 Hz的微控制器生成的串行端口接收9600波特的数据流,并且必须根据某些规则“if”和“if-else”过滤消息,以去除标题字符并将其寻址到其他变量以供计算使用。 代码如下:

 class Stripper
{
 public  void  Distri (string inComing, out string param1, out string param2, out string param3, out string param4)
    {
        string currentRes="";
        string currentMot = "";
        string temperature="";
        string numRPM="";
        string f = inComing;
        if (inComing.Length < 6)
        {
            f = ">123456<";
        }
        char firstChar = f[0];
        char lastChar = f[f.Length - 2];
        bool test1 =(firstChar.Equals('>'));
        bool test2 =(lastChar.Equals('<'));
        int messLenght = f.Length;

        try
        {
            if (test1 == true && test2 == true && messLenght <= 10)
            {
                f = f.Replace("<", "");
                f = f.Replace(">", "");

                if (f[0] == 'I')
                {
                    string _currentRes = f;
                    _currentRes = _currentRes.Replace("I", "");
                    currentRes = _currentRes;
                }

                else if (f[0] == 'M')
                {
                    string _currentMot = f;
                    _currentMot = _currentMot.Replace("M", "");
                    currentMot = _currentMot;
                }

                else if (f[0] == 'T')
                {
                    string _temperature = f;
                    _temperature = _temperature.Replace("T", "");
                    temperature = _temperature;
                }
                else if (f[0] == 'N')
                {
                    string _numRPM = f;
                    _numRPM = _numRPM.Replace("N", "");
                    numRPM = _numRPM;
                }

                else
                { }
            }

            else
            { }
        }
        catch (System.Exception)
        {

            throw;
        }

        param1 = currentRes;
        param2 = temperature;
        param3 = numRPM;
        param4 = currentMot;

        }
       }
      }
类剥离器
{
公共void发行版(输入字符串、输出字符串param1、输出字符串param2、输出字符串param3、输出字符串param4)
{
字符串currentRes=“”;
字符串currentMot=“”;
字符串温度=”;
字符串numRPM=“”;
字符串f=传入;
如果(输入长度<6)
{

f=“>123456我在快速搜索中找到了它
Debug.WriteLine()

是要写入VS输出窗口的内容

因此,您将能够获得您的实时值


另请参见此

您可以创建一个日志文件作为断点的替代方案谢谢您的建议。这肯定是一个很好的替代方案,但不能实时了解正在发生的情况。但是,我以前没有考虑过它,我将尝试使用它。您也可以在VS中写入输出窗口,但我不知道如何操作,我刚才您可以这样做n do it:D?发布的代码不太可能与问题有关。典型的问题是使用DataReceived事件和调用Begin/Invoke太频繁。使用Invoke请求打击UI线程,使其在无法跟上时变得紧张,并停止绘制和响应用户输入。通过使DataReceived事件ent正在做更多的工作,在调用之前收集整个设备响应。忽略SerialPort.Read()返回值也是一个典型的错误。在代码段中看不到这些。谢谢。非常感谢,但我仍然不理解断点为什么会导致这样的问题。可能是基于“正常“使用它,以便它尝试获取每个反射的所有有价值的信息(但我不知道)