Font warning error

Hello team,
We are using the IWarningCallback interface to capture font warnings. This implementation works perfectly fine in Aspose version 20.12, but throws an error during document save in the latest version (26.9). How should we rewrite this for the new version?

Below code is used.

    public class HandleDocumentWarnings : Aspose.Words.IWarningCallback
    {
        public List<FontWarningMsg> lstWarningMsg = new List<FontWarningMsg>();
        public void Warning(Aspose.Words.WarningInfo info)
        {
            if (info.WarningType == Aspose.Words.WarningType.FontSubstitution)
            {
                Match match = Regex.Match(info.Description.ToString(), @"'([^']*)");
                FontWarningMsg fontWarningMsg = new FontWarningMsg();
                fontWarningMsg.WarningType = info.WarningType.ToString();
                fontWarningMsg.Description = info.Description.ToString();
                if (match.Success)
                {
                    fontWarningMsg.FontName = match.Groups[1].Value.Trim();
                }
                lstWarningMsg.Add(fontWarningMsg);
            }
        }
    }
Document doc = new Document("C:\\test.Docm");
Document worddoc1;
FontSourceBase[] originalFontSources = FontSettings.DefaultInstance.GetFontsSources();
string strFontFolderPath = Convert.ToString(ConfigurationManager.AppSettings["FontFolderPath"].ToString());
// Create a font source from a folder that contains fonts.
FolderFontSource folderFontSource = new FolderFontSource(strFontFolderPath, true);
// Apply a new array of font sources that contains the original font sources, as well as our custom fonts.
FontSourceBase[] updatedFontSources = { originalFontSources[0], folderFontSource };
FontSettings.DefaultInstance.SetFontsSources(updatedFontSources);
var obj = new HandleDocumentWarnings();
doc.WarningCallback = obj;
worddoc1 = doc.Range.ToDocument();
worddoc1.Save("C:\\test.pdf", options);

Below Error thrown.

@RiteshK10 Could you please zip and attach the problematic input document here for testing? We will check the issue and provide you more information.

Hello @alexey.noskov ,
We have attached the problematic input document here for testing. So, please check and resolve error.

FontWarningCallBack.zip (55.4 KB)

@RiteshK10 Thank you for additional information. You attached test application, but it does not include the problematic input document (C:\test.Docm). Could you please attach it here for testing?