Crash on document name when sending package
Wednesday, August 22, 2018 at 05:10amHi,
I receive an error when the document name ends with "pdf". For example "Testpdf.pdf".
My workaround is to add another character to the document name ("Testpdfx.pdf").
Perhaps something to attend to in a future release.
regards,
Ronald
The error:
Silanis.ESL.SDK.EslException: Could not upload document to package. Exception: Index and count must refer to a location within the string.
Parameter name: count ---> System.ArgumentOutOfRangeException: Index and count must refer to a location within the string.
Parameter name: count
at System.String.Remove(Int32 startIndex, Int32 count)
at Silanis.ESL.SDK.Internal.MimeTypeUtil.GetMIMEType(String fileName)
at Silanis.ESL.SDK.Services.PackageService.CreateMultipartContent(String fileName, Byte[] fileBytes, Byte[] payloadBytes, String boundary)
at Silanis.ESL.SDK.Services.PackageService.UploadDocument(DocumentPackage package, String fileName, Byte[] fileBytes, Document document)
--- End of inner exception stack trace ---
at Silanis.ESL.SDK.Services.PackageService.UploadDocument(DocumentPackage package, String fileName, Byte[] fileBytes, Document document)
at Silanis.ESL.SDK.EslClient.CreatePackage(DocumentPackage package)
at Silanis.ESL.SDK.EslClient.CreateAndSendPackage(DocumentPackage package)
My code (shortend):
var doc = DocumentBuilder.NewDocumentNamed(document.Name).FromStream(fs, docType).WithId(request.DocumentId.ToString()); ... package.WithDocument(doc); var packageId = eslClient.CreateAndSendPackage(package.Build()); // -- The error occurres here
Reply to: Crash on document name when sending package
Thursday, August 23, 2018 at 05:14am.FromStream(fs, docType)
which means there must be a docType (I derive this from the Java SDK, following is the source code) So can you share me more about how to reproduce this error? And thanks again for your posting. :) DuoReply to: Crash on document name when sending package
Monday, August 10, 2020 at 02:52pmWas this ever resolved? I'm getting the same error. The document will upload by calling package.WithDocument(DocumentBuilder.NewDocumentNamed(doc.name)
.FromStream(fs, Silanis.ESL.SDK.DocumentType.PDF));
The exception happens when calling CreatePackage(package)