Upgrade from Aspose 19.2 to 21.7 cause Exception

Hi,

We purchased Aspose 19.2 and everything was well.
Now we want to upgrade to Aspose 21.7 so we got a temporary license (there is no problem with the license).
The same code that worked well in 19.2, throw an exception in 21.7:
We get the error : “com.aspose.pdf.internal.ms.System.l8l: Cannot access a disposed object.
Object name: ‘Document’.”,in this line of code:
PdfPageStamp pageStamp = new PdfPageStamp(pdfTemplaeDocument.getPages().get_Item(1));
pdfTemplaeDocument is the file that we want to add to it a stamp.

We tried a lot to understand the cause of this strange error.
Is there any change in the constructor implementation of PdfPageStamp? Any idea?

Thanks!

@liad2508

The code seems fine. Could you please share complete code snippet along with sample file so that we can also test the scenario in our environment and address it accordingly?