Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Clearscript V8 engine hang while debugging

0
0
Hi,

I have included test project in github((https://github.com/NKumarPraveen/ClearScriptV8Debugger)). issue with stream reading from engine.
                if(Connected)
                {
                    //await streamWriter.WriteAsync(request).ConfigureAwait(false);                    
                    //await streamWriter.FlushAsync().ConfigureAwait(false);
                    WriteToLogFile("Writting to stream. Message:" + request);  

                    streamWriter.Write(request);
                    streamWriter.Flush();
                                       
                    WriteToLogFile("Written to stream. Message:" + request);                    
                }   
and
            {
                TcpClient networkClient;
                
                lock (m_networkClientLock)
                {
                    networkClient = m_tcpClient;
                }

                var networkStream=networkClient.GetStream();
                //networkStream.ReadTimeout = 2000;

                using (var streamReader = new StreamReader(networkStream, Encoding.Default))                              
                {                    
                   while (Connected) 
                   {
                       //if (networkStream.DataAvailable)
                       {
                           try
                           {
                               WriteToLogFile("Before Response: ");

                               var result = await streamReader.ReadLineAsync().ConfigureAwait(false);
                               //var result = streamReader.ReadLine();

                               WriteToLogFile("Response from engine. Response: " + result);

                               if (result == null)
                               {
                                   continue;
                               }

                               // Check whether result is content length header
                               var match = m_contentLength.Match(result);

                               if (!match.Success)
                               {
                                   //DebugWriteLine(string.Format("Debugger info: {0}", result));
                                   continue;
                               }

                               await streamReader.ReadLineAsync().ConfigureAwait(false);

                               // Retrieve content length
                               var length = int.Parse(match.Groups[1].Value);
                               if (length == 0)
                               {
                                   continue;
                               }

                               // Read content
                               string message = await streamReader.ReadLineBlockAsync(length).ConfigureAwait(false);

                               WriteToLogFile("Response from engine. Response: " + message);

                               HandleOutput(message);
                           }
                           catch (Exception exx)
                           {
                               WriteToLogFile("Exception reading from stream. Err Mesg:" + exx.Message + Environment.NewLine);
                           }
                       }
                    }
                }
            }
Also logging to text file in temp folder(V8Enginelog.log).

Thanks and Regards
Praveen

Viewing all articles
Browse latest Browse all 2297