Null Reference Exception when Using Ink Annotation
Hello everyone,
As I mentioned in post 183376, I have encountered an issue with the program that leads to a null reference exception. Today, I was able to reproduce it, and here are the steps to reproduce the problem:
- Run the program and open any PDF file.
- Use the Ink Annotation tool to draw any ink strokes.
- Select "Delete Annotation."
- Right-click on the ink stroke you just drew.
- At this point, it may result in either:
- A null reference exception.
- The ink stroke getting deleted normally, but new ink strokes becoming undeletable.
Also, is there any way to disable the pop-up dialog that appears when closing the program? This prompt is unnecessary for me. If anyone knows how to disable it within the program, I would greatly appreciate your guidance. Thank you all for your help!
Attachment: Syncfusion_PDFView_de42603.zip
Hi Rhyme,
|
With the provided details, "NullReference exception occurs when we delete ink annotation using right click selection event" issue can be reproduced on our end. We will analyze this issue and provide further updates on August 8, 2023. |
|
|
We are not able to reproduce the reported issue on our end with the provided details. So we have recorded a video which we tried to reproduce on our end. Please check on this and share us a recorded video about how to reproduce the reported issue on our end. If it is document specific, please share us the Pdf document also. It will be helpful for us to investigate further. |
|
|
Also, is there any way to disable the pop-up dialog that appears when closing the program? This prompt is unnecessary for me. If anyone knows how to disable it within the program, I would greatly appreciate your guidance. Thank you all for your help! |
In WPF PdfViewer, we can diable the save changes dialog box by using the WarnBeforeClose API. Please use the below code snippet and sample to disable the pop-up dialog that appears when closing the window.
|
Attachment: Syncfusion_PDF_d9dabf32.zip
Hello Krithika,
Thank you for your assistance! I have successfully disabled the prompt that appears when closing the program. I tried a few more times regarding the issue of being unable to delete ink strokes, and I recorded a relevant video. At approximately 25 seconds into the video, it appears that the selection event might not be triggered due to the small area of the ink stroke. Interestingly, when I drew additional strokes, the deletion function worked normally for them.
Furthermore, I am curious if it's possible to disable the right-click menu that appears after selecting an ink stroke. I suspect that this menu might be causing the null reference exception. I would like to attempt disabling the right-click menu to observe if the null reference issue persists.
Any insights or suggestions would be greatly appreciated. Thank you once again for your help!
Best regards,
Jine
Attachment: 20230807_094922_79efc3c9.zip
Hello everyone,
I hope you're all doing well. I just wanted to share an additional video recording as a supplement to our previous discussion. Please find the attached file and take a look.
Attachment: video_22a9adc2.7z
Hi Jine,
Right click selection is not working properly in rare cases. We will check on this and update further details on August 9, 2023.
To disable right click selection, we have attached a sample which we have modified from your sample. In attached sample, we have disable right click selection of annotation as we have restricted right click event influence from PdfViewer in sample. Please let us know whether this suggestion meet your requirement.
Regards,
Krithika
hi, Krithika
I haven't seen the attachment you mentioned. Could you please resend it or provide me with more information about where I can find it? Thank you.
Hi Jine,
Sorry for the inconvenience, we have missed to attach the sample in our previous update. Please find the attachment for the sample which we have created for you.
Attachment: Syncfusion_PDF_3a31ad5a.zip
The reported issue occurs when we right click the two intersecting ink annotations. Due to the complexity, we need time to analysis a lot more in-depth. We will update further details on August 10, 2023.
hi Manigandan,
I appreciate the update. I'll patiently await further details on August 10, 2023. Thank you for your assistance! Additionally, I've already downloaded the files from the attachment, but it seems that the right-click menu can still be accessed.
Code:
PdfSyncfusionDocument.MouseRightButtonUp += PdfSyncfusionDocument_MouseRightButtonUp;
private void PdfSyncfusionDocument_MouseRightButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
e.Handled = true;
}
Hi,
|
Right click selection is not working properly in rare cases. We will check on this and update further details on August 9, 2023. |
We have confirmed the issue “Ink annotation was not selected properly when right click on it.” as a defect in our product and we will include the fix into our upcoming weekly NuGet release on Aug 22,2023. Please use the below feedback link to track the status of the reported bug.
Note: If you require a patch for the reported issue in any of our Essential Studio Main or SP release version, then kindly let us know the version, so that we can provide a patch in that version based on our SLA policy.
Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.”
|
|
|
Additionally, I've already downloaded the files from the attachment, but it seems that the right-click menu can still be accessed. |
From the information provided, it seems that you are utilising a MouseRightButtonUp event, so the selection exists. However, In the sample that we provided earlier, we recommend using the PreviewMouseRightButtonUp event. Please refer to the code snippet for your reference.
|
|
|
The reported issue occurs when we right click the two intersecting ink annotations. Due to the complexity, we need time to analysis a lot more in-depth. We will update further details on August 10, 2023. |
As we mentioned earlier, we will update further details on Aug 10,2023 |
hi, Manigandan:
Thank you for your proactive assistance. The right-click menu has been disabled successfully. I am looking forward to the resolution of the other two issues. Your help is greatly appreciated.
Hi Rhyme,
The reported issue "NullReference
exception occurs when we delete ink annotation using the right click selection
event" will be resolve with the fix for “Ink annotation was not
selected properly when right click on it”. So, this will also get
resolve in our upcoming weekly NuGet release on August 22, 2023.
Please use the below feedback link to
track the status of the reported bug.
https://www.syncfusion.com/feedback/46005/ink-annotation-was-not-selected-properly-when-right-click-on-it
We have included the fix for these issues “NullReference exception occurs when we delete ink annotation using the right click selection event”and “Ink annotation was not selected properly when right click on it” fix in our latest weekly release (22.2.10).
Please use the below link to download our latest NuGet,
Nuget Link:
https://www.nuget.org/packages/Syncfusion.PdfViewer.WPF/22.2.10
Feedback Link:
hi, Manigandan:
I would like to express my heartfelt gratitude for the diligent efforts put into implementing these fixes. Your commitment to resolving these issues is truly commendable. Thank you very much!
Hi Rhyme,
We highly value your thoughtful feedback. We're pleased that our efforts have led to positive outcomes.
If you need any additional assistance, please don't hesitate to reach out.
Thank you for your continued support!
Regards,
Swetha