Windows.Data.Pdf.PdfDocument Crash with file size greater than 2GB
Same issue as here (no replies there, it's an old thread)
https://learn.microsoft.com/en-us/answers/questions/248422/windows-data-pdf-pdfdocument-crash
My notes:
Crash is not catchable which makes it really hard to find reason for issue or workaround.
I've tried the file in the official demo sample app and it crashes too. The file can be opened in other PDF software (including Edge - although slowly - which is funny because I think it uses the Windows.Data.Pdf library as well if I'm correct?)
After a bit more research, it seems the size is indeed what makes it crash. Another PDF lib I tried crashed similarly when the stream length exceeded Int32.MaxValue. The exception was catchable in this one so I could get a proper error message.
My laptop has 16GB of ram (nothing else running really) and 140GB free SSD space so I hope that's not the issue.
I can provide a storage link to a crashing file if necessary.
Same error on Windows 10 and Windows 11, both 64 bits, app is 64 bits.
Universal Windows Platform (UWP)
C#
-
Junjie Zhu - MSFT 19,751 Reputation points • Microsoft Vendor
2024-11-13T02:39:50.7+00:00 Hello @Jérôme S ,
Welcome to Microsoft Q&A!
Could you please provide the code snippet and the pdf file to help us further check the problem for you? and be careful not to include any personal privacy.
Thank you.
-
Jérôme S 5 Reputation points
2024-11-13T07:58:32.9566667+00:00 Hi, sure, you can use the code from the sample:
https://github.com/microsoft/Windows-universal-samples/tree/main/Samples/PdfDocument/cs
Specifically that is the code line that will crash:
await PdfDocument.LoadFromFileAsync(file, PasswordBox.Password);
and this is a file that will crash (avoiding bots - remove REMOVE from the link below)
https://drive.google.com/file/d/1comy_coG5P6LREMOVElxLfsoe6F-QfEEaZpKxJ/view?usp=sharing
-
Junjie Zhu - MSFT 19,751 Reputation points • Microsoft Vendor
2024-11-14T02:57:00.3433333+00:00 Hello @Jérôme S ,
Could you please share it through GitHub?
-
Jérôme S 5 Reputation points
2024-11-14T08:35:52.68+00:00 Not sure what you mean. Share a 2GB+ file through github?
if you can't access google drive I can use wetransfer or onedrive..
-
Junjie Zhu - MSFT 19,751 Reputation points • Microsoft Vendor
2024-11-15T08:38:44.5033333+00:00 Due to policy reasons, I cannot download files on OneDrive or Google drive.
-
Jérôme S 5 Reputation points
2024-11-15T21:00:43.01+00:00 Would it work for you if I put it somewhere on an azure blob storage? Or maybe if you have policy restrictions you can provide a link where I can send it to.
-
Jérôme S 5 Reputation points
2024-11-18T09:21:42.5833333+00:00 I've put it here. Let me know if that's okay. Same thing remove REMOVE.
https://frenchfryfiles.blob.core.windows.net/cover/REMOVE6385f8b5-6597-4b0b-8c7e-cfe258d3a95a.pdf
-
EckiS 916 Reputation points
2024-11-18T11:39:31.0166667+00:00 the example project has
<Prefer32Bit>true</Prefer32Bit>
so even on Windows 64bit the process can not use more then 2GB of memory.
does it also crash when you set Prefer32Bit to false? -
Jérôme S 5 Reputation points
2024-11-18T18:32:06.81+00:00 I'm not using AnyCPU but x64 when building, so as far as I know it should be able to use more than 2GB of memory.
I tried setting Prefer32Bits to false and it still crashes identically.
-
Junjie Zhu - MSFT 19,751 Reputation points • Microsoft Vendor
2024-11-19T09:45:48.71+00:00 When I opened the link, the content is
This XML file does not appear to have any style information associated with it. The document tree is shown below. <Error> <Code>BlobNotFound</Code> <Message>The specified blob does not exist. RequestId:bd1deabd-201e-0004-2b67-3a3200000000 Time:2024-11-19T09:44:27.7151598Z</Message> </Error>
-
Jérôme S 5 Reputation points
2024-11-19T14:31:07.28+00:00 Did you remove REMOVE from the link as mentioned?
-
Junjie Zhu - MSFT 19,751 Reputation points • Microsoft Vendor
2024-11-20T09:08:22.4666667+00:00 Hello @Jérôme S ,
I successfully downloaded the file you shared, and I can reproduce the same behavior.
If this unexpected behavior has a serious business impact, I suggest that you might need to open a support ticket for this. Please contact our paid support at MS Support.
You will get 1:1 support on that. Select Developer Tools -> Windows UWP Development -> Windows 10 Universal App Dev -> Runtime Platform in the support page and you could contact the team. Please kindly note that your support ticket will be free if it is Microsoft's issue.
Thank you. -
Jérôme S 5 Reputation points
2024-11-20T09:35:11.1566667+00:00 Hello,
I can't create the support ticket because it's telling me I need to "Add contract" or "Add subscription" and I don't know what I'm supposed to input there.
Are there other ways to contact the support that don't require having a subscription? To be honest, I thought that's what I was doing by reporting this here.
-
Junjie Zhu - MSFT 19,751 Reputation points • Microsoft Vendor
2024-11-21T04:10:54.5366667+00:00 Hello @Jérôme S ,
This is an unexpected behavior and the Q&A forums cannot be of any further help. There is a fee to open a support ticket for UWP, and your support ticket will be free if it is Microsoft's issue.
Thank you. -
Jérôme S 5 Reputation points
2024-11-21T15:19:39.41+00:00 But even though I'm baffled that I have to pay to report an issue, if I wanted to do it I wouldn't even be able to:
The only actions available are add contract and add subscription and both ask me for stuff (IDs of things) that I have no idea what they could be.
I see MSFT in your name, can't you just raise this thing internally? or notify it to someone who can?
-
Junjie Zhu - MSFT 19,751 Reputation points • Microsoft Vendor
2024-11-22T02:44:45.6266667+00:00 Hello @Jérôme S ,
For your scenario, if this unexpected behavior has a serious business impact, I suggest that you need to open a support ticket for this, this is the fastest way to get feedback. This requires you to purchase a support plan, please kindly note that your support ticket will be free if it is Microsoft's issue.
If this behavior has little impact, we recommend that you submit this behavior in Feedback Hub. You could find the Feedback Hub in the Start Menu. Please select Developer Platform->API Feedback as the category when you submit your request. The related team will check the request. After you submit the request, please share your link, I will help you submit this request as well.
Thank you. -
Jérôme S 5 Reputation points
2024-11-23T11:32:45.4233333+00:00 Thanks, I've created it on feedback hub, here's the link
https://aka.ms/AAtjr1z -
Jérôme S 5 Reputation points
2024-11-23T11:34:23.04+00:00 Seems like yet another issue with the link provided by the feedback hub, it just redirects to bing homepage.
I could find this link as well, maybe you can do something of it..
feedback-hub:?contextid=951&feedbackid=d4ee1ff6-98f1-45df-8ea4-ec7807f7a229&form=1&src=1
-
Junjie Zhu - MSFT 19,751 Reputation points • Microsoft Vendor
2024-11-25T09:50:02.16+00:00 The link I can open properly and navigate to the problem you submitted in the feedbackhub. I will help you submit this request.
-
Jérôme S 5 Reputation points
2024-11-27T08:23:05.7333333+00:00 Yes it seems to work now, maybe it took a while to propagate.
Thanks for the help!
-
Junjie Zhu - MSFT 19,751 Reputation points • Microsoft Vendor
2024-11-28T07:42:46+00:00 Hello @Jérôme S ,
I have already reported this unexpected behavior through internal channels, but it will take some time to fix this unexpected behavior.
Thank you.
Sign in to comment