How to fix a deprecated function in Microsoft Bot Framework
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";
}