From 94e37aef3847fe5d2c79214c727b453e3de49adb Mon Sep 17 00:00:00 2001 From: Brian Dukes Date: Thu, 19 Aug 2021 08:32:41 -0500 Subject: [PATCH 1/2] Resolve serialization issue Fixes #3592 --- .../AuthenticationConfigBase.cs | 74 ++++++++----------- 1 file changed, 32 insertions(+), 42 deletions(-) diff --git a/DNN Platform/Library/Services/Authentication/AuthenticationConfigBase.cs b/DNN Platform/Library/Services/Authentication/AuthenticationConfigBase.cs index a8a0aee0509..e47992808cd 100644 --- a/DNN Platform/Library/Services/Authentication/AuthenticationConfigBase.cs +++ b/DNN Platform/Library/Services/Authentication/AuthenticationConfigBase.cs @@ -1,50 +1,40 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace DotNetNuke.Services.Authentication -{ - using System; - using System.ComponentModel; +namespace DotNetNuke.Services.Authentication +{ + using System; + using System.ComponentModel; - using DotNetNuke.Common; + using DotNetNuke.Common; - /// ----------------------------------------------------------------------------- - /// - /// The AuthenticationConfigBase class provides base configuration class for the - /// Authentication providers. - /// - /// ----------------------------------------------------------------------------- - [Serializable] - public abstract class AuthenticationConfigBase + /// ----------------------------------------------------------------------------- + /// + /// The AuthenticationConfigBase class provides base configuration class for the + /// Authentication providers. + /// + /// ----------------------------------------------------------------------------- + [Serializable] + public abstract class AuthenticationConfigBase { - /// - /// Initializes a new instance of the class. - /// - public AuthenticationConfigBase() - { - this.DependencyProvider = Globals.DependencyProvider; + /// Initializes a new instance of the class. + public AuthenticationConfigBase() + { } - /// - /// Initializes a new instance of the class. - /// - /// - protected AuthenticationConfigBase(int portalID) - : this() - { - this.PortalID = portalID; - } - - [Browsable(false)] - public int PortalID { get; set; } - - /// - /// Gets the Dependency Provider to resolve registered - /// services with the container. - /// - /// - /// The Dependency Service. - /// - protected IServiceProvider DependencyProvider { get; } - } -} + /// Initializes a new instance of the class. + /// The portal ID. + protected AuthenticationConfigBase(int portalID) + : this() + { + this.PortalID = portalID; + } + + [Browsable(false)] + public int PortalID { get; set; } + + /// Gets the Dependency Provider to resolve registered services with the container. + [NonSerialized] + protected IServiceProvider DependencyProvider => Globals.DependencyProvider; + } +} From 54a46e364b51eb649156111362d477254f61cc45 Mon Sep 17 00:00:00 2001 From: Brian Dukes Date: Thu, 19 Aug 2021 08:42:56 -0500 Subject: [PATCH 2/2] NonSerialized can only apply to a field Using a computed property instead of a property with a backing field should be enough to avoid the serialization issue --- .../Library/Services/Authentication/AuthenticationConfigBase.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/DNN Platform/Library/Services/Authentication/AuthenticationConfigBase.cs b/DNN Platform/Library/Services/Authentication/AuthenticationConfigBase.cs index e47992808cd..41b30e8df10 100644 --- a/DNN Platform/Library/Services/Authentication/AuthenticationConfigBase.cs +++ b/DNN Platform/Library/Services/Authentication/AuthenticationConfigBase.cs @@ -34,7 +34,6 @@ protected AuthenticationConfigBase(int portalID) public int PortalID { get; set; } /// Gets the Dependency Provider to resolve registered services with the container. - [NonSerialized] protected IServiceProvider DependencyProvider => Globals.DependencyProvider; } }