[HTML Comments] Unhandled `TargetInvocationException` when clicking on converted RTF task links
Posted: Sun Oct 25, 2020 11:53 am
Hi Dan,
ToDoList version: 8.0.9.0
I've been playing with the now built-in ConvertRTFToHTML tool and came across the following issue when converting tasks with links to other RTF tasks.
Steps to reproduce:
Outcome:
Clicking the link of the first task on the converted tasklist leads to the following .NET Framework unhandled exception (although the link still gets followed):
The stack trace is:
The outcome is the same whether we use MS Word or not for the conversion.
I've attached an input tasklist created by following the above steps (RTFTaskLinks-WithContent.tdl), alongside with the result of the conversion (CONVERTED_RTFTaskLinks-WithContent.tdl).
What's quite interesting is that the entire converted tasklist seems to have HTML task links messed up from then on. If you create a new HTML task and try to create new links to and from it, they will all fail with the above error (which does not happen for RTF links nor does it happen on a fresh new tasklist).
Other scenarios
* If you omit step 4 and don't add any content to the second task (RTFTaskLinks-WithoutContent.tdl), then the problem does not occur (CONVERTED_RTFTaskLinks-WithoutContent.tdl). I also noticed that the second task still remains as an RTF task after conversion which might explain why this happens.
* This is a minor one, but if you have RTF task links wrapped in parenthesis -- e.g. (tdl://2) -- they will not be converted as links in HTML but instead plain text.
ToDoList version: 8.0.9.0
I've been playing with the now built-in ConvertRTFToHTML tool and came across the following issue when converting tasks with links to other RTF tasks.
Steps to reproduce:
Code: Select all
1. Create new tasklist
2. Add a RTF task.
3. Add second RTF task.
4. Add any content to the second task (a single character will do).
5. Right click the second RTF task and copy it as a task link.
6. Paste link in the first task.
7. Save tasklist and use RTFToHTMLConverter.
Clicking the link of the first task on the converted tasklist leads to the following .NET Framework unhandled exception (although the link still gets followed):
The stack trace is:
Code: Select all
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Value does not fall within the expected range.
at MSHTML.IHTMLTxtRange.moveToElementText(IHTMLElement element)
at MSDN.Html.Editor.HtmlEditorControl.SelectElement(HtmlElement element)
at HTMLContentControl.TDLHtmlEditorControl.OnDocumentMouseUp(Object sender, HtmlElementEventArgs e)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Forms.HtmlShim.FireEvent(Object key, EventArgs e)
I've attached an input tasklist created by following the above steps (RTFTaskLinks-WithContent.tdl), alongside with the result of the conversion (CONVERTED_RTFTaskLinks-WithContent.tdl).
What's quite interesting is that the entire converted tasklist seems to have HTML task links messed up from then on. If you create a new HTML task and try to create new links to and from it, they will all fail with the above error (which does not happen for RTF links nor does it happen on a fresh new tasklist).
Other scenarios
* If you omit step 4 and don't add any content to the second task (RTFTaskLinks-WithoutContent.tdl), then the problem does not occur (CONVERTED_RTFTaskLinks-WithoutContent.tdl). I also noticed that the second task still remains as an RTF task after conversion which might explain why this happens.
* This is a minor one, but if you have RTF task links wrapped in parenthesis -- e.g. (tdl://2) -- they will not be converted as links in HTML but instead plain text.