stevencohn / OneMore

A OneNote add-in with simple, yet powerful and useful features
Mozilla Public License 2.0
2.57k stars 215 forks source link

Preview Markdown: IndentLevel error #1438

Closed seaspeak closed 2 months ago

seaspeak commented 3 months ago

Problem to Solve

Casual indetntation causes the error.

To Reproduce

Steps to reproduce the behavior:

  1. Import the file indent-error.xml
  2. Preview indent-error.zip

Expected Behavior

Check with loose syntax. Seeing errors is better than seeing nothing at all.

Screenshots

image

Environment (if applicable)

Additional Context

14|09:43:41.463| Running command PreviewMarkdownCommand
14|09:43:41.498| Error running command PreviewMarkdownCommand
14|09:43:41.498| System.NullReferenceException
Message: Object reference not set to an instance of an object.
Source: River.OneMoreAddIn
StackTrace:    at River.OneMoreAddIn.Models.PageEditor.IndentLevel(XElement element)
   at River.OneMoreAddIn.Models.PageEditor.<ExtractSnippets>d__21.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at River.OneMoreAddIn.Models.PageEditor.<ExtractSnippets>d__21.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`1.GetResult()
   at River.OneMoreAddIn.Models.PageEditor.<ExtractSelectedContent>d__18.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`1.GetResult()
   at River.OneMoreAddIn.Commands.PreviewMarkdownCommand.<Execute>d__1.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.CommandFactory.<Run>d__6.MoveNext()
TargetSite: [River.OneMoreAddIn] River.OneMoreAddIn.Models.PageEditor::IndentLevel()
abaichuan1017 commented 3 months ago

me too