modery / PowerDocu

Generate technical documentation from your existing Power Automate Flows and Power Apps canvas apps
MIT License
441 stars 73 forks source link

DirectoryNotFoundException ConnectorIcons\connectors.json #139

Closed keinMEME closed 1 month ago

keinMEME commented 9 months ago

Describe the bug I've tried @a1dancole's CLI extension with the following parameters: dotnet run --project PowerDocu.GUI\PowerDocu.GUI.csproj -- --updateIcons="true"

It throws an System.IO.DirectoryNotFoundException, because the connectorIcons directory is missing. I looked the folder up in the windows file explorer. The message is correct, the expected folders do not exist yet.

I also ran the code in debugger mode without parameters. This time it worked. I figured out that the reason is that the folder creation only happens when I run the powerdocu in "gui mode", so I narrowed down the exact code snippet (see below).

Since I know what's wrong, it's not hard to work around the problem. But I would consider this an easy fix and hope it will be fixed in the next release.

Further descriptions Terminal-Logs:

Updating Connectors list, please wait. An error occured while trying to update the connector list: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\xy\AppData\Roaming\PowerDocu.GUI\ConnectorIcons\connectors.json'. at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options) at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode) at System.IO.File.OpenHandle(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) at System.IO.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding) at PowerDocu.Common.ConnectorHelper.UpdateConnectorIcons() in C:\Users\xy\lmn\xyz\abc\modules\PowerDocu.Common\PowerDocu.Common\ConnectorHelper.cs:line 102

Here is the Code-Snippet. It crashes because of the "folderpath" variable. Those directories weren't created in "CLI-mode" image image

Here is the code snippet where the directory is created: File: PowerDocu.GUI\PowerDocuForm.Designer.cs image

To Reproduce Steps to reproduce the behavior:

  1. Just Delete the folder "PowerDocu_GUI" from "../AppData/Roaming"
  2. Then run the project in the terminal: dotnet run --project PowerDocu.GUI\PowerDocu.GUI.csproj -- --updateIcons="true"

Expected behavior I would expect that i can run the project without errors in the cli-mode and don't have to run it in the GUI-mode first.

modery commented 9 months ago

Hi @keinMEME , thank you for the detailed error report! It is indeed a simple fix, added the relevant code already (https://github.com/modery/PowerDocu.Common/commit/8974c02cc3ae5d2733454aca84069f9ca43ea263). Will be part of the next release, which I hope will be ready within the next week

modery commented 4 months ago

Hi, this has been fixed in today's 2.0.1 release. Can you confirm if you still get the error?

keinMEME commented 1 month ago

Hi, seems fine. Thank you.