Example #1
0
        /// <summary>
        /// Create instance of ThreadData class to collect information about used threads
        /// </summary>
        internal ThreadData(IEnumerable <BacktraceStackFrame> exceptionStack, bool faultingThread)
        {
            var current = Thread.CurrentThread;
            //get current thread id
            string generatedMainThreadId = current.GenerateValidThreadName().ToLower();

            ThreadInformations[generatedMainThreadId] = new ThreadInformation(current, exceptionStack, faultingThread);
            //set currentThreadId
            MainThread = generatedMainThreadId;
        }
        internal static ThreadData DeserializeThreadInformation(JToken token)
        {
            var @thread = new ThreadData();

            foreach (BacktraceJProperty threadData in token)
            {
                //parse all dictionaries of values
                ThreadInformation values = null;
                //threadInformation contain single thread json
                foreach (var threadInformation in threadData)
                {
                    values = ThreadInformation.Deserialize(threadInformation);
                }
                thread.ThreadInformations.Add(threadData.Name, values);
            }
            return(thread);
        }