Document document = new Document(“some file name”);
var taggedContent = document.TaggedContent;
StackTrace: at System.Xml.XmlDocument.AddAttrXmlName(String prefix, String localName, String namespaceURI, IXmlSchemaInfo schemaInfo) in //src/libraries/System.Private.Xml/src/System/Xml/Dom/XmlDocument.cs:line 246
at System.Xml.XmlDocument.CreateAttribute(String prefix, String localName, String namespaceURI) in //src/libraries/System.Private.Xml/src/System/Xml/Dom/XmlDocument.cs:line 1077
at System.Xml.XmlDocument.CreateAttribute(String name) in //src/libraries/System.Private.Xml/src/System/Xml/Dom/XmlDocument.cs:line 621
at System.Xml.XmlElement.SetAttribute(String name, String value) in //src/libraries/System.Private.Xml/src/System/Xml/Dom/XmlElement.cs:line 292
at #=zjQRU3Ao6xrQglQDRuDAyxDoJwXDnliF5fgby7_8=.#=zK0TKl6M=()
at #=zRur_uMF2pkzVB0ObnCEGKmOTmZX_fGcNN3L5eHU=.#=zO7BbkWdjmvny(XmlWriter #=z2SoVpeo=, #=znW6c6Kz1bkIt6JQavitBbpbULd53Eoll4VBbe7g= #=z4CBTcAA=)
at #=zRur_uMF2pkzVB0ObnCEGKmOTmZX_fGcNN3L5eHU=.#=zO7BbkWdjmvny(Stream #=zpCqxRiM=, Int32 #=zS9olONc=)
at #=zvtO6Ng$WpwYB54ImeHA3xachkgcINUx$g3YrQuY=.#=zAXS20pc=(#=zRur_uMF2pkzVB0ObnCEGKmOTmZX_fGcNN3L5eHU= #=znMMS7AE=, Boolean #=zzXFX2oqk_4XT)
at #=zvtO6Ng$WpwYB54ImeHA3xachkgcINUx$g3YrQuY=.#=z3eVHLp4ztRSz(#=zRur_uMF2pkzVB0ObnCEGKmOTmZX_fGcNN3L5eHU= #=zK1Y9$H4=)
at #=zuTuMyEuDuO0yqfG15EVOd7ocgYLG.#=z41mhV3jKGcJ1()
at #=zuTuMyEuDuO0yqfG15EVOd7ocgYLG…ctor(Document #=z_UAyEcE=)
at #=zHfMpHx8S3XPVBqRdjpgWwigKIRkX…ctor(Document #=z_UAyEcE=)
at Aspose.Pdf.Document.get_TaggedContent()
The error has occurred once on different files. Unfortunately it cannot be reproduced. Can you suggest any possible reasons?
@sergei.shibanov
I have added one of the files with which there was a problem. However, the problem does not seem to be related to a specific file, but rather to a situation when many files are being processed at the same time. Dogovir _Test vid 17.03.2022.docx (16.9 KB)
@sergei.shibanov
We’re actually creating a document from a MemoryStream, so it’s a new document every time.
I added a very simplified version of the code first, it actually looks something like this:
private byte[] TestMethod(byte[] pdfDocIn)
{
using (var pdfDocStream = new MemoryStream())
{
pdfDocStream.Write(pdfDocIn, 0, pdfDocIn.Length);
pdfDocStream.Seek(0, SeekOrigin.Begin);
using (var pdfDoc = new Aspose.Pdf.Document(pdfDocStream))
{
var taggedContent = document.TaggedContent;
//some another code
pdfDoc.Save(pdfDocStream);
pdfDoc.FreeMemory();
}
return pdfDocStream.ToArray();
}
}
@asposeuuups
Please see if I am trying to reproduce the error correctly, based on the given code?
(this fragment works without errors on my environment)
static private byte[] TestMethod()
{
var document = new Document(myDir + "Dogovir _Test vid 17.03.2022.pdf");
var pdfDocIn = File.ReadAllBytes(myDir + "Dogovir _Test vid 17.03.2022.pdf");
using (var pdfDocStream = new MemoryStream())
{
pdfDocStream.Write(pdfDocIn, 0, pdfDocIn.Length);
pdfDocStream.Seek(0, SeekOrigin.Begin);
using (var pdfDoc = new Aspose.Pdf.Document(pdfDocStream))
{
var taggedContent = document.TaggedContent;
//some another code
pdfDoc.Save(pdfDocStream);
pdfDoc.FreeMemory();
}
return pdfDocStream.ToArray();
}
}
static private byte[] TestMethod(byte[] pdfDocIn)
{
using (var pdfDocStream = new MemoryStream())
{
pdfDocStream.Write(pdfDocIn, 0, pdfDocIn.Length);
pdfDocStream.Seek(0, SeekOrigin.Begin);
using (var pdfDoc = new Aspose.Pdf.Document(pdfDocStream))
{
var taggedContent = pdfDoc.TaggedContent;
//some another code
pdfDoc.Save(pdfDocStream);
pdfDoc.FreeMemory();
}
return pdfDocStream.ToArray();
}
}
and
var result = TestMethod(File.ReadAllBytes(myDir + "Dogovir _Test vid 17.03.2022.pdf"));
But as I said “the problem does not seem to be related to a specific file, but rather to a situation when many different files are being processed at the same time.”
@asposeuuups
The development team says that in one of the latest releases there were changes regarding the simultaneous work with many documents. Try the latest version of the library - 23.4
Hi, @sergei.shibanov , we are using Aspose.PDF 24.1.0 on .Net 6 and running into this error. Has there been changes since this version that might re-introduce a bug on ‘simultaneous work with many documents’? Thanks!
Hi @asad.ali , I don’t think this is related to the NullReferenceException that I posted. May I get some support on figuring out if there been changes since Aspose.pdf for .NET version 24.1.0 that might re-introduce a bug on ‘simultaneous work with many documents’? Thanks!
Around that time, there were changes associated with simultaneous work on several DIFFERENT documents. I can’t say about the details now, but they were there. It just obviously didn’t help with your problem.
The development team did nothing specifically in this area. Have you experienced noticeable deterioration since version 24.01? Perhaps you could provide code with test data that would allow you to reproduce the error?