diff --git a/source/dotnet/Library/AdaptiveCards/AdaptiveAuthCardButton.cs b/source/dotnet/Library/AdaptiveCards/AdaptiveAuthCardButton.cs index 017781f055..6d1fa8350d 100644 --- a/source/dotnet/Library/AdaptiveCards/AdaptiveAuthCardButton.cs +++ b/source/dotnet/Library/AdaptiveCards/AdaptiveAuthCardButton.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; using System.Xml.Serialization; namespace AdaptiveCards @@ -8,6 +9,7 @@ namespace AdaptiveCards /// /// Class for AuthCardButton /// + [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))] public class AdaptiveAuthCardButton { /// diff --git a/source/dotnet/Library/AdaptiveCards/AdaptiveAuthentication.cs b/source/dotnet/Library/AdaptiveCards/AdaptiveAuthentication.cs index 2572e7b39b..c6fe2f4657 100644 --- a/source/dotnet/Library/AdaptiveCards/AdaptiveAuthentication.cs +++ b/source/dotnet/Library/AdaptiveCards/AdaptiveAuthentication.cs @@ -1,7 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; using System.Collections.Generic; +using System.Net; using System.Xml.Serialization; namespace AdaptiveCards @@ -9,6 +11,7 @@ namespace AdaptiveCards /// /// Class to for authentication data. /// + [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))] public class AdaptiveAuthentication { /// @@ -16,14 +19,14 @@ public class AdaptiveAuthentication /// [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] [XmlAttribute] - public string Text { get; set; } + public string Text { get; set; } = "Please sign in"; /// /// The identifier for registered OAuth connection setting information. /// [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] [XmlAttribute] - public string ConnectionName { get; set; } + public string ConnectionName { get; set; } = "Default"; /// /// Provides information required to enable on-behalf-of single sign-on user authentication. diff --git a/source/dotnet/Library/AdaptiveCards/AdaptiveTokenExchangeResource.cs b/source/dotnet/Library/AdaptiveCards/AdaptiveTokenExchangeResource.cs index a95746972c..687dfe882a 100644 --- a/source/dotnet/Library/AdaptiveCards/AdaptiveTokenExchangeResource.cs +++ b/source/dotnet/Library/AdaptiveCards/AdaptiveTokenExchangeResource.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; using System.Xml.Serialization; namespace AdaptiveCards @@ -8,6 +9,7 @@ namespace AdaptiveCards /// /// Class for TokenExchangeResource /// + [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))] public class AdaptiveTokenExchangeResource { /// diff --git a/source/dotnet/Library/AdaptiveCards/ParseContext.cs b/source/dotnet/Library/AdaptiveCards/ParseContext.cs index 4171937634..08045397e9 100644 --- a/source/dotnet/Library/AdaptiveCards/ParseContext.cs +++ b/source/dotnet/Library/AdaptiveCards/ParseContext.cs @@ -118,14 +118,10 @@ public void PopElement() // add an entry for this element if it's fallback (we'll add one when we parse it for non-fallback) if (!isFallback) { - try - { - elementIds[elementID].Add(nearestFallbackID); - } - catch (KeyNotFoundException) - { + if (!elementIds.TryGetValue(elementID, out var list)) elementIds[elementID] = new List() { nearestFallbackID }; - } + else + list.Add(nearestFallbackID); } } idStack.Pop();