NEST/Elasticsearch.Net version: 7.17.0
NLog version: 5.0.3
Platform: .NET Core / .NET5 / NET6
Exception occurs on different .net projects and it happens randomly after starting to log to an elasticsearch cluster. It does not happen while writing to a local file. Similar exceptions with suggestions to try to fix it by modifying NLog configuration with setting "MaxRecursionLimit=1" did not work, and it was suggested that this is a NEST/Elasticsearch client issue: Elasticsearch.Net.UnexpectedElasticsearchClientException: Failed to serialize anonymous type when writting to NLog · Issue #182 · markmcdowell/NLog.Targets.ElasticSearch · GitHub
Error ElasticSearch: Error while sending log messages Exception: Elasticsearch.Net.UnexpectedElasticsearchClientException: Failed to serialize anonymous type: System.RuntimeType · Issue #5616 · NLog/NLog · GitHub
Thank you in advance