From 9fe222c6dd715fabdba64f7cd7c235542aa539ff Mon Sep 17 00:00:00 2001 From: Evolva <ber.fabien@gmail.com> Date: Wed, 16 Sep 2020 21:29:26 +0200 Subject: [PATCH] Fix HasProperty when settings is a Dictionary (#358) --- .../Sinks/ElasticSearch/ElasticSearchSink.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Serilog.Sinks.Elasticsearch/Sinks/ElasticSearch/ElasticSearchSink.cs b/src/Serilog.Sinks.Elasticsearch/Sinks/ElasticSearch/ElasticSearchSink.cs index fec5d5ff..a49bfe9f 100644 --- a/src/Serilog.Sinks.Elasticsearch/Sinks/ElasticSearch/ElasticSearchSink.cs +++ b/src/Serilog.Sinks.Elasticsearch/Sinks/ElasticSearch/ElasticSearchSink.cs @@ -156,7 +156,7 @@ protected virtual void HandleException(Exception ex, IEnumerable<LogEvent> event // Helper function: checks if a given dynamic member / dictionary key exists at runtime private static bool HasProperty(dynamic settings, string name) { - if (settings is System.Dynamic.ExpandoObject) + if (settings is IDictionary<string, object>) return ((IDictionary<string, object>)settings).ContainsKey(name); if (settings is System.Dynamic.DynamicObject)