Analogy-LogViewer / Analogy.LogViewer

A customizable Log Viewer with ability to create custom providers. Can be used with C#, C++, Python, Java and others
MIT License
306 stars 41 forks source link

System.ArgumentException when using the 'messages grouping' tab with a log file that contains custom columns #225

Closed Numpsy closed 4 years ago

Numpsy commented 4 years ago

Describe the bug

I was using the 4.2.3.0 viewer release to view a test Serilog/Clef file and look at the custom columns added by the custom columns feature, and when I tried to use the Messages Grouping tab/feature, I got a message box popup containing

---------------------------
Error
---------------------------
Error: System.ArgumentException: Column 'CustomProperty2' does not belong to table .
   at System.Data.DataRow.GetDataColumn(String columnName)
   at System.Data.DataRow.set_Item(String columnName, Object value)
   at Analogy.Utils.CreateRow(DataTable table, AnalogyLogMessage message, String dataSource, Boolean checkAdditionalInformation) in C:\git\Analogy.LogViewer\Analogy\Utils.cs:line 306
   at Analogy.UCLogs.gridViewGrouping_FocusedRowChanged(Object sender, FocusedRowChangedEventArgs e) in C:\git\Analogy.LogViewer\Analogy\UserControls\UCLogs.cs:line 1995
   at DevExpress.XtraGrid.Views.Base.ColumnView.RaiseFocusedRowChanged(Int32 prevFocused, Int32 focusedRowHandle)
   at DevExpress.XtraGrid.Views.Grid.GridView.RaiseFocusedRowChanged(Int32 prevFocused, Int32 focusedRowHandle)
   at DevExpress.XtraGrid.Views.Base.ColumnView.DoChangeFocusedRowInternal(Int32 newRowHandle, Boolean updateCurrentRow)
   at DevExpress.XtraGrid.Views.Grid.GridView.OnCurrentControllerRowChanged(CurrentRowEventArgs e)
   at DevExpress.Data.BaseGridController.OnCurrentControllerRowChanged()
   at DevExpress.Data.BaseGridController.ResetCurrentPosition()
   at DevExpress.Data.CurrencyDataController.OnDataSourceChanged()
   at DevExpress.Data.CurrencyDataController.SetDataSource(BindingContext context, Object dataSource, String dataMember)
   at DevExpress.XtraGrid.Views.Base.BaseView.SetDataSource(BindingContext context, Object dataSource, String dataMember)
   at DevExpress.XtraGrid.Views.Grid.GridView.SetDataSource(BindingContext context, Object dataSource, String dataMember)
   at DevExpress.XtraGrid.GridControl.ActivateDataSource()
   at DevExpress.XtraGrid.GridControl.set_DataSource(Object value)
   at Analogy.UCLogs.ApplyGrouping() in C:\git\Analogy.LogViewer\Analogy\UserControls\UCLogs.cs:line 1790
   at Analogy.UCLogs.sBtnLength_Click(Object sender, EventArgs e) in C:\git\Analogy.LogViewer\Analogy\UserControls\UCLogs.cs:line 1775
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at DevExpress.XtraEditors.BaseButton.OnMouseUp(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at DevExpress.Utils.Controls.ControlBase.WndProc(Message& m)
   at DevExpress.XtraEditors.BaseControl.WndProc(Message& msg)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
---------------------------
OK   
---------------------------

To Reproduce Have a Serilog/Clef file containing the JSON from the issue at https://github.com/Analogy-LogViewer/Analogy.LogViewer.Serilog/issues/44

Open that file with the Serilog parser

Switch the view to the 'messages grouping' tab

enter a number in the 'group by text length' box and click 'set length'

Result: A message box about an exception pops up.

Screenshots If applicable, add screenshots to help explain your problem. image

Desktop (please complete the following information): Windows 10 64-bit

LiorBanai commented 4 years ago

Oops, I missed that part of the code when adding the new feature.