#1954·serilog

Top-level byte array isn't destructured, but other byte sequences are

Author: cmeerenCreated Sep 13, 2023Updated Sep 19, 2023
Labelsdiscussion

Repro:

f#
open System.Collections.Generic
open Serilog
open Serilog.Core

type TestDestructuringPolicy() =
    interface IDestructuringPolicy with
        member this.TryDestructure(_value, propertyValueFactory, result) =
            result <- propertyValueFactory.CreatePropertyValue("TEST")
            true

Log.Logger <-
    LoggerConfiguration()
        .Destructure.With(TestDestructuringPolicy())
        .WriteTo.Console()
        .CreateLogger()

Log.Information("Byte list: {@Data}", List([ 1uy ]))
Log.Information("Byte array: {@Data}", [| 1uy |])

Log.CloseAndFlush()

Expected output:

[10:49:50 INF] Byte list: TEST
[10:49:50 INF] Byte array: TEST

Actual output:

[10:49:50 INF] Byte list: TEST
[10:49:50 INF] Byte array: 01

Top-level byte arrays aren't passed to my destructuring policy. This seems inconsistent. Could this inconsistency be fixed, so that byte arrays are passed to the destructuring policy?