PowerApps-Tooling icon indicating copy to clipboard operation
PowerApps-Tooling copied to clipboard

Handling windows long path names

Open mikefactorial opened this issue 1 year ago • 2 comments

cat_devopskitsamplecanvasapp_c7ec5_DocumentUri.zip

ALMAcceleratorSampleSolution_1_0_20231002_41.zip

Describe the bug

PAC CLI recently introduced full support for using long paths when unpacking solutions using clone/sync but it appears that when you use long path notation in combination with --processCanvasApps that the canvas unpack fails with the error below. This also happens using pac solution unpack i.e.

This succeeds

pac solution unpack --zipfile \\?\C:\temp\ALMAcceleratorSampleSolution_1_0_20231002_41.zip --folder \\?\C:\temp

While this fails

pac solution unpack --zipfile \\?\C:\temp\ALMAcceleratorSampleSolution_1_0_20231002_41.zip --folder \\?\C:\temp --processCanvasApps true
Extracting \\?\C:\temp\ALMAcceleratorSampleSolution_1_0_20231002_41.zip to \\?\C:\temp

Skipping localization
Processing Component: Entities
 - cat_AlmAcceleratorSample
Processing Component: Roles
 - ALM Accelerator Sample Role
Processing Component: Workflows
 - App Title
 - Email Quote
 - Get Current Temperature
 - Like Quote
 - SÆmple Ø ærlig forsøk
 - GetEnvironmentVariableValues
Processing Component: EntityRelationships
Processing Component: SolutionPluginAssemblies
 - PCATPlugins, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7719a0cacdbc4de8
Processing Component: SdkMessageProcessingSteps
 - 2e9fc4e4-ddf0-ed11-8848-6045bd08d866
Processing Component: ServiceEndpoints
Processing Component: AppModuleSiteMaps
 - cat_AlmAcceleratorSampleMda
Processing Component: AppModules
 - cat_AlmAcceleratorSampleMda
Processing Component: CanvasApps
 - cat_devopskitsamplecanvasapp_c7ec5
Processing Component: Connectors
 - cat_5Fenvironmentvariableconnector

-- unpacking Canvas app cat_devopskitsamplecanvasapp_c7ec5...
Unpack from \\?\C:\temp\CanvasApps\cat_devopskitsamplecanvasapp_c7ec5_DocumentUri.msapp --> \\?\C:\temp\CanvasApps\src\cat_devopskitsamplecanvasapp_c7ec5
  source format version: 0.24
Microsoft PowerPlatform CLI
Version: 1.30.7+ge6211cf
Online documentation: https://aka.ms/PowerPlatformCLI
Feedback, Suggestions, Issues: https://github.com/microsoft/powerplatform-build-tools/discussions

Error: Invalid URI: The hostname could not be parsed.

    Invalid URI: The hostname could not be parsed.

        Invalid URI: The hostname could not be parsed.

Steps to reproduce the behavior: This isn't specific to PAC CLI since it fails when running unpack directly from PASopa with the same error.

  1. Unpack and Copy the attached .msapp to C:\temp\canvas\
  2. From the command line run PASopa.exe -unpack \\?\C:\temp\canvas\cat_devopskitsamplecanvasapp_c7ec5_DocumentUri.msapp
  3. src directory is created and it appears to have unpacked the app successfully but the command line shows the following error
Error   PA3001: Internal error. Invalid URI: The hostname could not be parsed.
Stack Trace:
   at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind, UriCreationOptions& creationOptions)
   at System.Uri..ctor(String uriString)
   at Microsoft.PowerPlatform.Formulas.Tools.IO.FilePath.GetRelativePath(String relativeTo, String fullPathFile) in C:\source\repos\PowerApps-Tooling\src\PAModel\IO\FilePath.cs:line 114
   at Microsoft.PowerPlatform.Formulas.Tools.IO.DirectoryReader.<>c__DisplayClass3_0.<EnumerateFiles>b__0(String fullPath) in C:\source\repos\PowerApps-Tooling\src\PAModel\IO\DirectoryReader.cs:line 90
   at System.Linq.Utilities.<>c__DisplayClass2_0`3.<CombineSelectors>b__0(TSource x)
   at System.Linq.Enumerable.SelectEnumerableIterator`2.ToArray()
   at Microsoft.PowerPlatform.Formulas.Tools.IO.DirectoryReader.EnumerateFiles(String subdir, String pattern, Boolean searchSubdirectories) in C:\source\repos\PowerApps-Tooling\src\PAModel\IO\DirectoryReader.cs:line 97
   at Microsoft.PowerPlatform.Formulas.Tools.SourceSerializer.LoadFromSource(String directory2, ErrorContainer errors) in C:\source\repos\PowerApps-Tooling\src\PAModel\Serializers\SourceSerializer.cs:line 103
   at Microsoft.PowerPlatform.Formulas.Tools.CanvasDocument.<>c__DisplayClass32_0.<LoadFromSources>b__0() in C:\source\repos\PowerApps-Tooling\src\PAModel\CanvasDocument.cs:line 145
   at Microsoft.PowerPlatform.Formulas.Tools.CanvasDocument.Wrapper(Func`1 worker, ErrorContainer errors) in C:\source\repos\PowerApps-Tooling\src\PAModel\CanvasDocument.cs:line 226
   at Microsoft.PowerPlatform.Formulas.Tools.CanvasDocument.LoadFromSources(String pathToSourceDirectory) in C:\source\repos\PowerApps-Tooling\src\PAModel\CanvasDocument.cs:line 145
   at Microsoft.PowerPlatform.Formulas.Tools.CanvasDocument.SaveToSources(String pathToSourceDirectory, String verifyOriginalPath) in C:\source\repos\PowerApps-Tooling\src\PAModel\CanvasDocument.cs:line 185
   at PASopa.Program.<>c__DisplayClass0_0.<Main>b__0() in C:\source\repos\PowerApps-Tooling\src\PASopa\Program.cs:line 139
   at PASopa.Program.TryOperation(Func`1 operation) in C:\source\repos\PowerApps-Tooling\src\PASopa\Program.cs:line 291
1 errors, 0 warnings.
  1. Alternatively copy the attached solution zip to C:\temp\
  2. Run From the command line run pac solution unpack --zipfile \\?\C:\temp\ALMAcceleratorSampleSolution_1_0_20231002_41.zip --folder \\?\C:\temp --processCanvasApps true
  3. The pac command fails completely with the error noted above.

@rajeevpentyala for awareness

mikefactorial avatar Feb 16 '24 13:02 mikefactorial

processCanvasApps and canvas pack/unpack are still "experimental" feature which is not fully supported

petrochuk avatar Feb 16 '24 17:02 petrochuk

@petrochuk thanks. Any chance this will be fixed at some point or should we provide the above to anyone facing this issue?

mikefactorial avatar Feb 26 '24 14:02 mikefactorial