How to fix a deprecated function in Microsoft Bot Framework

Lalith Anand S 0 Reputation points
2024-09-13T12:24:47.22+00:00

Hi, I am facing an issue with Microsoft Bot Framework.

I'm working with a legacy project built on dotnetcore3.1 and Microsoft.Bot.Builder Framework 4.8.3. Right now, I'm trying to upgrade the vulnerable packages detected by our Code Scan Tool.

When upgrading to higher versions of Microsoft.Bot.Builder (beyond 4.8.3), I encounter DialogManager class is marked as "Obsolete" and hence it cannot be instantiated.

I am looking for a fix which needs to be implemented for this class.

Can someone please help me find out the documentation or implementation (in a sample project) for this.

Here's the code:

Snippet 1(calling the function where error pops up)

private void LoadRootDialogAsync()

{

try

{

var rootDialogName = this.Configuration.GetSection("rootDialogName").Get<string>();

var rootFile = this.resourceExplorer.GetResource(rootDialogName);

var rootDialog = this.resourceExplorer.LoadType<Dialog>(rootFile);

this.dialogManager = new DialogManager(rootDialog)

.UseResourceExplorer(this.resourceExplorer)

.UseLanguageGeneration();

}

Decompiled dll in Visual Studio

namespace Microsoft.Bot.Builder.Dialogs

{

    /// <summary>

    /// Class which runs the dialog system.

    /// </summary>

    [Obsolete("This class will be deprecated in the next version of the Bot Framework SDK.")]

    public class DialogManager

    {

        private const string LastAccess = "_lastAccess";

        private string _rootDialogId;

        private readonly string _dialogStateProperty;

        /// <summary>

        /// Initializes a new instance of the <see cref="DialogManager"/> class.

        /// </summary>

        /// <param name="rootDialog">Root dialog to use.</param>

        /// <param name="dialogStateProperty">alternate name for the dialogState property. (Default is "DialogState").</param>

        public DialogManager(Dialog rootDialog = null, string dialogStateProperty = null)

        {

            if (rootDialog != null)

            {

                RootDialog = rootDialog;

            }

            _dialogStateProperty = dialogStateProperty ?? "DialogState";

        }

Azure AI Bot Service
Azure AI Bot Service
An Azure service that provides an integrated environment for bot development.
841 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
3,342 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.