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:

  1. Run the program and open any PDF file.
  2. Use the Ink Annotation tool to draw any ink strokes.
  3. Select "Delete Annotation."
  4. Right-click on the ink stroke you just drew.
  5. At this point, it may result in either:
    1.  A null reference exception.
    2. 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!


1.PNG


Attachment: Syncfusion_PDFView_de42603.zip

14 Replies 1 reply marked as answer

KG Krithika Ganesan Syncfusion Team August 4, 2023 02:05 PM UTC

Hi Rhyme,

    1.  A null reference exception.

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.

    1. The ink stroke getting deleted normally, but new ink strokes becoming undeletable.

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.

PdfSyncfusionDocument.WarnBeforeClose = false;


Attachment: Syncfusion_PDF_d9dabf32.zip


RH Rhyme replied to Krithika Ganesan August 7, 2023 02:00 AM UTC

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


RH Rhyme August 7, 2023 07:20 AM UTC

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


KG Krithika Ganesan Syncfusion Team August 7, 2023 03:15 PM UTC

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



RH Rhyme replied to Krithika Ganesan August 8, 2023 12:19 AM UTC

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.



KG Krithika Ganesan Syncfusion Team August 8, 2023 05:53 AM UTC

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


MS Manigandan Shanmugam Syncfusion Team August 8, 2023 02:32 PM UTC

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.




RH Rhyme replied to Manigandan Shanmugam August 9, 2023 12:42 AM UTC

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;

        }




MS Manigandan Shanmugam Syncfusion Team August 9, 2023 02:27 PM UTC

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.

https://www.syncfusion.com/feedback/46005/ink-annotation-was-not-selected-properly-when-right-click-on-it

 

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.

 

PdfSyncfusionDocument.PreviewMouseRightButtonUp += PdfSyncfusionDocument_PreviewMouseRightButtonUp;
       
private void PdfSyncfusionDocument_PreviewMouseRightButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)

        {

            e.Handled = true;

        }

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



RH Rhyme replied to Manigandan Shanmugam August 10, 2023 12:50 AM UTC

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.



MS Manigandan Shanmugam Syncfusion Team August 10, 2023 12:09 PM UTC

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



MS Manigandan Shanmugam Syncfusion Team August 23, 2023 06:48 AM UTC

We have included the fix for these issues “NullReference exception occurs when we delete ink annotation using the right click selection eventand “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:

https://www.syncfusion.com/feedback/46005/ink-annotation-was-not-selected-properly-when-right-click-on-it


Marked as answer

RH Rhyme replied to Manigandan Shanmugam August 24, 2023 08:18 AM UTC

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!



SS Swetha Srikumar Syncfusion Team August 25, 2023 01:11 PM UTC

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


Loader.
Up arrow icon