PowerDocu icon indicating copy to clipboard operation
PowerDocu copied to clipboard

Error running PowerDocu.exe through PowerShell

Open fabipfr opened this issue 1 year ago • 4 comments

I'm trying to run PowerDocu.exe with PowerShells "Start-Process" cmdlet. Currently I'm getting this error output:

[...]
FlowDocumenter: Created documentation for renamed_solution.zip. A total of 43 files were processed in 28,0676974 seconds.
 - Processing renamed_solution.zip
AppDocumenter: Created Word documentation for renamed_solution.zip. A total of 0 files were processed in 0,0139564 seconds.
 - Processing renamed_solution.zip
System.UnauthorizedAccessException: Access to the path 'C:\solution.xml' is denied.
   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.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
   at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
   at System.IO.FileStream..ctor(String path, FileStreamOptions options)
   at System.IO.Compression.ZipFileExtensions.ExtractToFile(ZipArchiveEntry source, String destinationFileName, Boolean overwrite)
   at PowerDocu.Common.SolutionParser..ctor(String filename) in C:\Users\rene\GitHub\PowerDocu-Release\PowerDocu\modules\PowerDocu.Common\PowerDocu.Common\SolutionParser.cs:line 22
   at PowerDocu.SolutionDocumenter.SolutionDocumentationGenerator.GenerateDocumentation(String filePath, String fileFormat, Boolean documentDefaultChangesOnly, Boolean documentDefaults, String flowActionSortOrder, String wordTemplate, String outputPath) in C:\Users\rene\GitHub\PowerDocu-Release\PowerDocu\PowerDocu.SolutionDocumenter\SolutionDocumentationGenerator.cs:line 32
   at PowerDocu.GUI.PowerDocuCLI.GenerateDocumentation(CommandLineOptions options) in C:\Users\rene\GitHub\PowerDocu-Release\PowerDocu\PowerDocu.GUI\PowerDocuCLI.cs:line 80
   at PowerDocu.GUI.PowerDocuCLI.Run(String[] args) in C:\Users\rene\GitHub\PowerDocu-Release\PowerDocu\PowerDocu.GUI\PowerDocuCLI.cs:line 58

Before [...] the output suggests that everything works fine and the documentation finished successfully

To Reproduce Steps to reproduce the behavior:

  1. downloaded the PowerDocu-v.2.0.1.zip
  2. Opened PowerShell terminal inside the folder.
  3. Ran this command Start-Process -p "solution.zip" -o "outputPath" -m

I'm really looking forward for full CLI support! <3

fabipfr avatar Aug 14 '24 10:08 fabipfr

Hi @fabipfr , you mention Start-Process -p "solution.zip" -o "outputPath" -m which I'm struggling a bit with, can't replicate it with these parameters (PowerShell complains that -p and -o are ambigous, for example). Can you share more details how you're executing PowerDocu?

modery avatar Aug 24 '24 09:08 modery

Sorry, the Start-Process Syntax was wrong, it should be like this:

Start-Process -NoNewWindow -FilePath "PowerDocu.exe" -ArgumentList "-p solution.zip", "-m", "-o outputPath"

I also ran the cmdlet with the new PowerDocu-v.2.1.0, but got the same output 🥲

fabipfr avatar Aug 27 '24 06:08 fabipfr

I tried again as described with v2.1.0. I was able to Export Flows but not the Solution itself or a PowerApp. Got the same error as above, but this time with System.UnauthorizedAccessException: Access to the path 'C:\powerapp.msal' is denied. 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, Nullable1 unixCreateMode) at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable1 unixCreateMode) at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode) at System.IO.FileStream..ctor(String path, FileStreamOptions options) at System.IO.Compression.ZipFileExtensions.ExtractToFile(ZipArchiveEntry source, String destinationFileName, Boolean overwrite) at PowerDocu.Common.AppParser..ctor(String filename) in C:\Users\rene\GitHub\PowerDocu-Release\PowerDocu\modules\PowerDocu.Common\PowerDocu.Common\AppParser.cs:line 34 at PowerDocu.AppDocumenter.AppDocumentationGenerator.GenerateDocumentation(String filePath, String fileFormat, Boolean documentDefaultChangesOnly, Boolean documentDefaults, Boolean documentSampleData, String wordTemplate, String outputPath) in C:\Users\rene\GitHub\PowerDocu-Release\PowerDocu\PowerDocu.AppDocumenter\AppDocumentationGenerator.cs:line 18 at PowerDocu.SolutionDocumenter.SolutionDocumentationGenerator.GenerateDocumentation(String filePath, String fileFormat, Boolean documentDefaultChangesOnly, Boolean documentDefaults, Boolean documentSampleData, String flowActionSortOrder, String wordTemplate, String outputPath) in C:\Users\rene\GitHub\PowerDocu-Release\PowerDocu\PowerDocu.SolutionDocumenter\SolutionDocumentationGenerator.cs:line 24 at PowerDocu.GUI.PowerDocuCLI.GenerateDocumentation(CommandLineOptions options) in C:\Users\rene\GitHub\PowerDocu-Release\PowerDocu\PowerDocu.GUI\PowerDocuCLI.cs:line 80 at PowerDocu.GUI.PowerDocuCLI.Run(String[] args) in C:\Users\rene\GitHub\PowerDocu-Release\PowerDocu\PowerDocu.GUI\PowerDocuCLI.cs:line 58

Are there any updates or plans on CLI Support?

fabipfr avatar Nov 05 '24 10:11 fabipfr

I just resolved this. in the ArgumentsList the -p Parameter needs a Full Path (C:\Users...\solution.zip). If you reference a solution in the working directory (solution.zip) and not with the full path it leads to faulty paths like C:\solution.xml or C:\powerapp.msal. These files are supposed to be inside the solution.zip and not at C:. So to get it working with PowerShell Start-Process Full Paths are required, referencing files directly from the working directory is buggy.

fabipfr avatar Dec 20 '24 09:12 fabipfr

I just resolved this. in the ArgumentsList the -p Parameter needs a Full Path (C:\Users...\solution.zip). If you reference a solution in the working directory (solution.zip) and not with the full path it leads to faulty paths like C:\solution.xml or C:\powerapp.msal. These files are supposed to be inside the solution.zip and not at C:. So to get it working with PowerShell Start-Process Full Paths are required, referencing files directly from the working directory is buggy.

Hi @fabipfr , please provide the correct syntax for powershell which used to resolve with example. I tried with Start-Process -NoNewWindow -FilePath "PowerDocu.exe" -ArgumentList "-p solution.zip", "-m", "-o outputPath" , still throwing below error PS C:\Users\UmaP\Downloads\Tool\Powerdoc\PowerDocu-v.2.3.0> System.InvalidOperationException: Sequence contains more than one matching element at System.Linq.ThrowHelper.ThrowMoreThanOneMatchException() at System.Linq.Enumerable.TryGetSingle[TSource](IEnumerable1 source, Func2 predicate, Boolean& found) at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable1 source, Func2 predicate) at CommandLine.Core.TypeLookup.FindTypeDescriptorAndSibling(String name, IEnumerable1 specifications, StringComparer comparer) at CommandLine.Core.InstanceBuilder.<>c__DisplayClass1_01.<Build>b__9(String name) at CommandLine.Core.TokenPartitioner.PartitionTokensByType(IEnumerable1 tokens, Func2 typeLookup) at CommandLine.Core.TokenPartitioner.Partition(IEnumerable1 tokens, Func2 typeLookup) at CommandLine.Core.InstanceBuilder.<>c__DisplayClass1_01.<Build>b__5() at CommandLine.Core.InstanceBuilder.Build[T](Maybe1 factory, Func3 tokenizer, IEnumerable1 arguments, StringComparer nameComparer, Boolean ignoreValueCase, CultureInfo parsingCulture, Boolean autoHelp, Boolean autoVersion, Boolean allowMultiInstance, IEnumerable1 nonFatalErrors) at CommandLine.Parser.ParseArguments[T](IEnumerable1 args) at PowerDocu.GUI.PowerDocuCLI.Run(String[] args) in C:\Users\rene\GitHub\PowerDocu-Release\PowerDocu\PowerDocu.GUI\PowerDocuCLI.cs:line 34

umathesmart avatar Oct 29 '25 07:10 umathesmart

@umathesmart In the PowerShell ArgumentsList parameter you need to reference full paths. If you're on a windows machine C:\.........\solution.zip

fabipfr avatar Oct 30 '25 22:10 fabipfr