alxnbl / onenote-md-exporter

ConsoleApp to export OneNote notebooks to Markdown formats
GNU General Public License v3.0
919 stars 75 forks source link

Crash on startup #65

Closed johnmcd88 closed 1 year ago

johnmcd88 commented 2 years ago

Describe the bug I'm running onenotemdexporter v1.2 on Windows 10 with Office 2016; I have one notebook named "My Notes" with 24 sections opened in OneNote 2016 . When I try to run onenote-md-exporter from the command line I get a stack dump. Here's the command and resulting dump:

E:\Local Kits\OneNote Markdown Exporter>onenotemdexporter.exe -n "My Notes" Unhandled exception. System.Runtime.InteropServices.COMException (0x80040154): Class not registered (0x80040154 (REGDB_E_CLASSNOTREG)) at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean wrapExceptions, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& hasNoDefaultCtor) at System.RuntimeType.CreateInstanceDefaultCtorSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean fillCache) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, Boolean wrapExceptions) at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions) at System.Activator.CreateInstance(Type type) at alxnbl.OneNoteMdExporter.Program.RunOptions(Options opts) at alxnbl.OneNoteMdExporter.Program.<>c.

b__1_0(Options options) at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult1 result, Action1 action) at alxnbl.OneNoteMdExporter.Program.Main(String[] args)

If I double-click on the onenote-md-exporter to run it in Windows I get something similar - an 'Invalid cast' exception. I have VisualStudio 2019 installed so I downloaded the source, built the debug solution and ran it in debug. Here's what showed up when I ran it:

image

To Reproduce

Unknown

Expected behavior Program to run and allow me to select, open and export a OneNote notebook..

Logs Both log.txt and error.txt are empty.

Desktop (please complete the following information):

  • Windows version : Windows 10 64 bits
  • Office Version : Office 2016 64 bits

Additional context Add any other context about the problem here.

alxnbl commented 2 years ago

Hey @johnmcd88 , I encountered this issue on a computer on which the office installation was corrupted. I solved the issue by running the office repair utility, reboot, and restart the tool. Cf: https://support.microsoft.com/en-us/office/repair-an-office-application-7821d4b6-7c1d-4205-aa0e-a6b40c5bb88b .

By the way I will update the code in the next version to display a recommandation of doing this repair when a exception occurs during startup.

Could you try this solution and give me a feedback ?

gamexy commented 1 year ago

same problem for me. But I don't have Office, so the office repair utility can do nothing.

alxnbl commented 1 year ago

@gamexy If you don't have office at all, the tool can not work