bezzad / ErrorControlSystem

ErrorControlSystem is a .NET library created to automate handling .NET Windows-Base application exceptions and raise that to a sql server. This exception handler have some features as screen capturing, fetch server date time in exception occurrence time and etc.
http://bezzad.github.io/ErrorControlSystem/
GNU General Public License v3.0
32 stars 14 forks source link

Convert StackTrace to XML Format and Replace it by Exception.StackTrace #30

Closed bezzad closed 9 years ago

bezzad commented 9 years ago

I want convert StackTrace frames to a XML format and then use that in analyzer to fetch frame Namespace , Class , Method , FilePath , LineNo._ , ColumnNo. . For example this stack trace will be converted to xml:

StackTrace context:

at TestExpStackTraceSet.Form1..ctor() in d:\TestExpStackTraceSet\TestExpStackTraceSet\Form1.cs:line 28
   at TestExpStackTraceSet.Program.Main() in d:\TestExpStackTraceSet\TestExpStackTraceSet\Program.cs:line 19

XML context:

<StackTrace>
     <StackFrame index=0>
          <Namespace>TestExpStackTraceSet</Namespace>
          <Class>Form1</Class>
          <Method>.ctor()</Method>
          <FilePath line=28 column=90>
                 d:\TestExpStackTraceSet\TestExpStackTraceSet\Form1.cs
           </FilePath>
     </StackFrame>
     <StackFrame index=1>
          <Namespace>TestExpStackTraceSet</Namespace>
          <Class>Program</Class>
          <Method>Main()</Method>
          <FilePath line=19 column=48>
                d:\TestExpStackTraceSet\TestExpStackTraceSet\Program.cs
          </FilePath>
     </StackFrame>
</StackTrace>
bezzad commented 9 years ago

In issue #29 written how to replace Exception StackTrace by new StackTrace

bezzad commented 9 years ago

This issue solved, but not to XML format, so far the xml format have more data and in this state be to overflow the StackTrace size limitation at database, because that is 4000 char length and not more.

bezzad commented 9 years ago

in new system stack trace context saved this model:


-> N{TestStackTrace}.C{Form1}.M{button2_Click(Object sender, EventArgs e)} @{d:\Programming\temp\TestStackTrace\TestStackTrace\Form1.cs}:{Line:66,Column:13}
-> N{System.Windows.Forms}.C{Control}.M{OnClick(EventArgs e)}
-> N{System.Windows.Forms}.C{Button}.M{OnClick(EventArgs e)}
-> N{System.Windows.Forms}.C{Button}.M{OnMouseUp(MouseEventArgs mevent)}
-> N{System.Windows.Forms}.C{Control}.M{WmMouseUp(Message& m, MouseButtons button, Int32 clicks)}
-> N{System.Windows.Forms}.C{Control}.M{WndProc(Message& m)}
-> N{System.Windows.Forms}.C{ButtonBase}.M{WndProc(Message& m)}
-> N{System.Windows.Forms}.C{Button}.M{WndProc(Message& m)}
-> N{System.Windows.Forms}.C{ControlNativeWindow}.M{OnMessage(Message& m)}
-> N{System.Windows.Forms}.C{ControlNativeWindow}.M{WndProc(Message& m)}
-> N{System.Windows.Forms}.C{NativeWindow}.M{Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)}
-> N{System.Windows.Forms}.C{UnsafeNativeMethods}.M{DispatchMessageW(MSG& msg)}
-> N{System.Windows.Forms}.C{ComponentManager}.M{System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)}
-> N{System.Windows.Forms}.C{ThreadContext}.M{RunMessageLoopInner(Int32 reason, ApplicationContext context)}
-> N{System.Windows.Forms}.C{ThreadContext}.M{RunMessageLoop(Int32 reason, ApplicationContext context)}
-> N{System.Windows.Forms}.C{Application}.M{Run(Form mainForm)}
-> N{TestStackTrace}.C{Program}.M{Main()} @{d:\Programming\temp\TestStackTrace\TestStackTrace\Program.cs}:{Line:33,Column:13}
-> N{System}.C{AppDomain}.M{_nExecuteAssembly(RuntimeAssembly assembly, String[] args)}