Unable to cast Annot to widget

Product: PDFTron.NET.x64 C#

Product Version: 9.0.0 and 9.1.0

Please give a brief summary of your issue:
Unable to cast Annot back to widget

Please describe your issue and provide steps to reproduce it:
I having issue in the code. When I open a pdf document with form, I cannot cast the annot into widget to get the field information, even though it is a widget type.

Please provide a link to a minimal sample where the issue is reproducible:
Here is the sample code:

using (PDFDoc doc = new PDFDoc("some document with form and text field") {
	var page = doc.GetPage(1);
	var annot = page.GetAnnot(0);
	if (annot.GetType() == Annot.Type.e_Widget)
	{
        var widget = annot as Widget; // ** Cannot cast back to widget

        var field = widget.GetField();
	    .....
    }
}

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Please use the following pattern to convert an Annot to a Widget (or any other Annot types).

var widget = new Widget(annot);