Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception when reading Serilog-clef-files with enrichment using "Object" as the key #1629

Closed
opheoHeidrich opened this issue Feb 13, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@opheoHeidrich
Copy link

Describe the bug

A .clef file with the content:
{"@t":"2023-02-13T09:43:22.6297404Z","@mt":"This is a test!","@l":"Warning","Object":["Object1.ToString() Result","Object2.ToString() Result"]}
will result in an exception when read.
From a first analysis this exceptions happens in "Analogy.CommonControls.UserControls.LogMessagesUC.LogGridView_RowStyle" when direct casting the CellValue of the "Object" column into an AnalogyLogMessage. In the test log message the value is a string, wich can not be cast into an AnalogyLogMessage.

ℹ Computer information

  • OS: Windows 10 Enterprise, Version 19045.2486, 64 bit
  • Analogy Version: 4.11.1 .NET 6
  • Data Provider used: Serilog

📝 Provide detailed reproduction steps (if any)

  1. Create a .clef file with the content in the description
  2. Try to open the file

✔️ Expected result

Log can be opened.

❌ Actual result

System.InvalidCastException
HResult=0x80004002
Message=Unable to cast object of type 'System.String' to type 'Analogy.Interfaces.AnalogyLogMessage'.
Source=Analogy.CommonControls
StackTrace:
at Analogy.CommonControls.UserControls.LogMessagesUC.logGrid_FocusedRowChanged(Object sender, FocusedRowChangedEventArgs e) in C:\git\repos\Analogy.LogViewer\Analogy.CommonControls\UserControls\LogMessagesUC.cs:line 3253
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.Helpers.NewListSourceRowKeeper.RestoreCore()
at DevExpress.Data.DataController.OnPostRefresh(Boolean useRowsKeeper)
at DevExpress.Data.CurrencyDataController.OnPostRefresh(Boolean useRowsKeeper)
at DevExpress.Data.DataController.DoRefresh(Boolean useRowsKeeper)
at DevExpress.Data.DataController.OnBindingListChangedCore(ListChangedEventArgs e)
at DevExpress.Data.BaseGridController.OnBindingListChangedCore(ListChangedEventArgs e)
at DevExpress.Data.DataController.OnBindingListChanged(ListChangedEventArgs e)
at DevExpress.Data.CurrencyDataController.RaiseOnBindingListChanged(ListChangedEventArgs e)
at System.Data.DataView.OnListChanged(ListChangedEventArgs e)

📷 Screenshots

image

@LiorBanai
Copy link
Member

Hi @opheoHeidrich , I'm able to reproduce it. Will update

@LiorBanai LiorBanai self-assigned this Feb 13, 2023
@LiorBanai LiorBanai added the bug Something isn't working label Feb 13, 2023
@opheoHeidrich
Copy link
Author

I think using more unique keys for predefined columns with Analogy logic would help. For example using a prefix like "Analogy.". After looking a bit I would expect some problems when the log contains any of the keys used in Analogy.CommonControls.Utils.CreateRow. Most would not be as extreme as the cast-exception when using "Object" as key, but the other keys might still impact expected behaviour of those 'special' columns.

@LiorBanai
Copy link
Member

@opheoHeidrich yeah, this is the reason. I'll probably use GUID so there will be very low probably of Collisons

@LiorBanai
Copy link
Member

I have a fix. Will release new version later this week. Thanks for reporting this :)
image

@LiorBanai
Copy link
Member

released the new version with the fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants