OneMore icon indicating copy to clipboard operation
OneMore copied to clipboard

"Running command LinkReferencesCommand" silent exception

Open jasonjac2 opened this issue 2 years ago • 4 comments

Describe the bug I was running "Link References to this page" with "All sections in the current Notebook", runs a progress dialogue, that then goes away. So exception is swallowed. Check the logs below. I am happy to look at the XML to find the offending bit. I have done this on 2 pages now. The one here is: "Support Issues at DP ToC"

To Reproduce Steps to reproduce the behavior:

  • Goto a page
  • One More | References | Link References to this page
  • watch dialogue, it just goes away after a while.

Expected behavior I think it is supposed to insert a list of links to pages that link to this page.

Screenshots image

Environment (if applicable):

  • OneNote Version: O365 32 bit
  • OneMore Version 4.18 (latest)

Additional context

3 things:

  • Aside: It would be great if the log file also captured parameters set in the UI, it would make reproducing stuff so much easier.

  • Question: How do I deref from Line 72, position 22. to something in the "Show XML". I've gone to the page and show XML, Page info: "ALL", unchecked "Hide edited" & "Remove LF from CData", pasted into Notepad++ and line 72 & 73 (in case it is an out by one": </one:OE> </one:OEChildren>

  • Extract from log file, with the last line before the error. 952:22] ..searching for '\bSupport Issues at DP ToC\b' on [GR:544] [GR:1187] [GR:969] Screenconnect performance issues 952:22] ..' ' is an unexpected token. The expected token is ';'. Line 72, position 22. 952:22] ..System.Xml.XmlException Message: ' ' is an unexpected token. The expected token is ';'. Line 72, position 22. Source: System.Xml StackTrace: at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.HandleEntityReference(Boolean isInAttributeValue, EntityExpandType expandType, Int32& charRefEndPos) at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars) at System.Xml.XmlTextReaderImpl.FinishPartialValue() at System.Xml.XmlTextReaderImpl.get_Value() at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r) at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r, LoadOptions o) at System.Xml.Linq.XElement.ReadElementFrom(XmlReader r, LoadOptions o) at System.Xml.Linq.XElement.Load(XmlReader reader, LoadOptions options) at System.Xml.Linq.XElement.Parse(String text, LoadOptions options) at River.OneMoreAddIn.Extensions.ToXmlWrapper(String s) at River.OneMoreAddIn.XElementExtensions.TextValue(XElement element) at River.OneMoreAddIn.Commands.LinkReferencesCommand.GetSynopsis(Page page) at River.OneMoreAddIn.Commands.LinkReferencesCommand.<Execute>d__16.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at River.OneMoreAddIn.UI.ProgressDialog.<<OnShown>b__11_0>d.MoveNext() TargetSite: [System.Xml] System.Xml.XmlTextReaderImpl::Throw()

jasonjac2 avatar Aug 01 '22 17:08 jasonjac2

Just to Add to this, we are looking at reorganising a lot of our oneNote. We have < 10 notebooks shared amongst 4 of us and they are a mix of personal OneDrive and Sharepoint / OneDrive for Business.

There are thousands of pages with maybe a couple of hundred really key ones. I want to:

  • identify a page as key
  • Move or copy it to a new notebook (e.g. knowledgebase / procedures)
  • Know all the links to that page and goto each one and decide whether to update the link,

jasonjac2 avatar Aug 15 '22 10:08 jasonjac2

I may need more info here. The error is coming from a routine that takes the body or content of a page and extracts just the raw readable text that can be used to make up a short summary. There's something in that content that can't be parsed as valid XML.

To dereference the line/col, find the first one:Outline element (that is not a OneMore tagging bank) and start counting from there; this is the XML root element that it tries to parse.

stevencohn avatar Aug 26 '22 06:08 stevencohn

To be clear, it would be the content of this page that it's failing on: [GR:544] [GR:1187] [GR:969] Screenconnect performance issues

stevencohn avatar Aug 26 '22 12:08 stevencohn

Just to Add to this, we are looking at reorganising a lot of our oneNote. We have < 10 notebooks shared amongst 4 of us and they are a mix of personal OneDrive and Sharepoint / OneDrive for Business.

There are thousands of pages with maybe a couple of hundred really key ones. I want to:

* identify a page as key

* Move or copy it to a new notebook (e.g. knowledgebase / procedures)

* Know all the links to that page and goto each one and decide whether to update the link,

If I understand correctly, you want batch operations.

  • move all pages with a given key/tag to a new notebook
  • update all links to moved pages and so on.

I would also like an easy way to manage OneNote hierarchy. One of my biggest complaints is that if I right click on a page in the page list to copy a hyperlink to the page the page is selected. This means that I have to go back to the page where I wanted to paste the link. There are so many issues with notebook maintenance.

What if there was some kind of two column file explorer type view of the hierarchy that allowed quickly reorganizing notebooks, sections and pages?

julie777 avatar Sep 18 '22 15:09 julie777

@stevencohn I have a similar error using 5.1 Copy Link To Paragraph. The exception is nearly identical.
Copy Ling to Para for the line: 29/09/2022 JAC..... image throws the error image Works just fine.

This page is a lot smaller than the other one mentioned. I have made a copy of the page in question and reduced it to its minimum to get the error.

I think the minimum steps to reproduce are:

  • create a page
  • Add a heading "A Test"
  • add a line of text "A Test"
  • press
  • indent (tab)
  • paste in a screen grab image - not all screen grabs cause the problem, I think it may have to do with OCR, but I am not sure. This is one that broke it. Lots of others did as well,

image Not sure if the following is required -press

  • Type "C"
  • Your page shoudl look like:

image

Right click the "A Test" line in the body of the page OneMore: Copy Link to para (I have them as context menu items) Boom.

33160:8] Running command CopyLinkCommand 33160:8] Error running command CopyLinkCommand 33160:8] System.Xml.XmlException Message: An error occurred while parsing EntityName. Line 24, position 2. Source: System.Xml StackTrace: at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.HandleEntityReference(Boolean isInAttributeValue, EntityExpandType expandType, Int32& charRefEndPos) at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars) at System.Xml.XmlTextReaderImpl.FinishPartialValue() at System.Xml.XmlTextReaderImpl.get_Value() at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r) at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r, LoadOptions o) at System.Xml.Linq.XElement.ReadElementFrom(XmlReader r, LoadOptions o) at System.Xml.Linq.XElement.Load(XmlReader reader, LoadOptions options) at System.Xml.Linq.XElement.Parse(String text, LoadOptions options) at System.Xml.Linq.XElement.Parse(String text) at River.OneMoreAddIn.Extensions.ToXmlWrapper(String s) at River.OneMoreAddIn.XElementExtensions.TextValue(XElement element) at River.OneMoreAddIn.CopyLinkCommand.<Execute>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at River.OneMoreAddIn.CommandFactory.<Run>d__6.MoveNext() TargetSite: [System.Xml] System.Xml.XmlTextReaderImpl::Throw()

jasonjac2 avatar Sep 30 '22 11:09 jasonjac2

I think you're exactly right; it is the OCR text that confusing it. In this case, the OCR text contains an unfinished (invalid) XML snippet which is breaking the internal parsing of real XML when trying to extract text to name the link.

stevencohn avatar Sep 30 '22 17:09 stevencohn

Thanks for the steps to reproduce.

stevencohn avatar Sep 30 '22 17:09 stevencohn

Wow, now that's service you would normally pay an arm a leg for. Bug clarification one day, release the next. Thank you. Is it worth me reporting this to MS?

Defo want to get you on for a talk at our developer group meeting :-).

jasonjac2 avatar Oct 01 '22 05:10 jasonjac2

FIxed

jasonjac2 avatar Oct 05 '22 06:10 jasonjac2