Destructuring structures
krajek opened this issue · 4 comments
For now, we do not destructure any value type including structures. Obviously, it is correct for primitive types and for types like DateTime
or Guid
. I am not sure about user-defined structures. It seems to me that types like the following one
struct Point
{
public int X { get; set; }
public int Y { get; set; }
}
should be destructured.
@RehanSaeed what do you think?
Not sure about this one. Structs often implement ToString()
or should if they don't already, so I'm not sure that using reflection would always provide better results.
We could add this as an option but we'd have to add some code to check that the struct is not primitive. I'm not sure how we could do that, we could check by namespace I suppose.
Also, FYI, the changlog.md file needs updating after you released. I noticed you also updated the releases GitHub page. It might be worth sticking to one method to avoid differences.
Regarding CHANGELOG.md
, yes, I forgot about putting 4.0.0 in there. Now it is done.
Regarding GitHub releases: CHANGELOG.md
will be a definitive source of truth. Release pages are just a convenient way to start a release and create a tag.
Regarding structures: I am asking because I was surprised when I did characterization tests for the destructuring of struct
. Obviously, nobody asked for the feature yet, so I will put the idea on the shelf.
I wonder how JSON.NET implements this feature:
https://stackoverflow.com/questions/13804230/json-net-struct-serialization-discrepancy
@RehanSaeed at the time I started the issue I thought it would be useful. However, in almost two years of using Serilog.Exceptions
on every single project I never thought about or needed the feature. Closing.