microsoft / navcontainerhelper

Official Microsoft repository for BcContainerHelper, a PowerShell module, which makes it easier to work with Business Central Containers on Docker.
MIT License
385 stars 247 forks source link

Compile Folder removal of symbols folder fails: The process cannot access the file #3354

Closed lktraser closed 7 months ago

lktraser commented 8 months ago

Describe the issue When using bccontainerhelper >6.0.0 my build pipelines fail when they try to cleanup the symbols folder after compiling with a compile folder. I suspect this has something to do with how the app.json cache is created since this is only an issue when runtime packages are involved.

Rough outline of the script used as I can't post the entire script

$appSymbolsFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString())
New-Item -ItemType directory -Path $appSymbolsFolder -Force | Out-Null

try {
        // Download of multiple dependencies including runtime packages from other partners into the appSymbolsFolder

        if ($UpdateDependencies) {
            $compileparameters += @{
                UpdateDependencies = $true
            }
        }

        if ($enableCodeCop) {
            $compileparameters += @{
                EnableCodeCop = $true
                EnableUICop   = $true
            }
        }

        if ($enableAppSourceCop) {
            $compileparameters += @{
                EnableAppSourceCop = $true
            }
        }

        if ($enablePerTenantExtensionCop) {
            $compileparameters += @{
                EnablePerTenantExtensionCop = $true
            }
        }

        $compilefolder = New-BcCompilerFolder -artifactUrl $artifactUrl

        $output = Compile-AppWithBcCompilerFolder @compileparameters -compilerFolder $compilefolder
    }
    catch {
        Write-Error $_.Exception.Message
    }
    finally {
        Remove-Item -Path $appSymbolsFolder -Recurse -Force
        if ($null -ne $compilefolder) {
            Remove-BcCompilerFolder -compilerFolder $compilefolder -ErrorAction Continue
        }
    }

Full output of scripts

BcContainerHelper version 6.0.4
BC.HelperFunctions emits usage statistics telemetry to Microsoft
Running on PowerShell 7

using Expand-Archive
Using Symbols Folder: ***\AppData\Local\Temp\d7a60887-5d5f-4488-892e-f26c02e1e2ba
Enumerating Apps in CompilerFolder C:\ProgramData\BcContainerHelper\compiler\1fcd6ebe-b335-4144-bc74-81939aabc4bf\symbols
::group::Getting .app info C:\ProgramData\BcContainerHelper\compiler\1fcd6ebe-b335-4144-bc74-81939aabc4bf\symbols\cache_AppInfo.json
- Microsoft__Exclude_APIV1_ Tests.app (succeeded)                                                                       
- Microsoft__Exclude_APIV1_.app (succeeded)
- Microsoft__Exclude_APIV2_ Tests.app (succeeded)                                                                       
- Microsoft__Exclude_APIV2_.app (succeeded)
- Microsoft__Exclude_Bank Deposits Tests.app (succeeded)                                                                
- Microsoft__Exclude_Bank Deposits.app (succeeded)
- Microsoft__Exclude_ClientAddIns_.app (succeeded)                                                                      
- Microsoft__Exclude_Email Logging Using Graph API Tests.app (succeeded)
- Microsoft__Exclude_Email Logging Using Graph API.app (succeeded)                                                      
- Microsoft__Exclude_PlanConfiguration_ Tests.app (succeeded)
- Microsoft__Exclude_PlanConfiguration_.app (succeeded)                                                                 
- Microsoft__Exclude_ReportLayouts.app (succeeded)
- Microsoft_AMC Banking 365 Fundamentals Test Automations.app (succeeded)                                               
- Microsoft_AMC Banking 365 Fundamentals.app (succeeded)
- Microsoft_Any.app (succeeded)                                                                                         
- Microsoft_API Reports - Finance.app (succeeded)
- Microsoft_Application.app (succeeded)
- Microsoft_Base Application.app (succeeded)                                                                            
- Microsoft_Company Hub.app (succeeded)
- Microsoft_Contoso Coffee Demo Dataset (DE).app (succeeded)                                                            
- Microsoft_Contoso Coffee Demo Dataset.app (succeeded)
- Microsoft_Czech language (Czechia).app (succeeded)                                                                    
- Microsoft_Danish language (Denmark).app (succeeded)
- Microsoft_Data Archive Tests.app (succeeded)                                                                          
- Microsoft_Data Archive.app (succeeded)
- Microsoft_Data Search Tests.app (succeeded)                                                                           
- Microsoft_Data Search.app (succeeded)                                                                                 
- Microsoft_Dutch language (Belgium).app (succeeded)
- Microsoft_Dutch language (Netherlands).app (succeeded)                                                                
- Microsoft_ELSTER VAT Localization for Germany Tests.app (succeeded)
- Microsoft_ELSTER VAT Localization for Germany.app (succeeded)                                                         
- Microsoft_Email - Current User Connector Tests.app (succeeded)
- Microsoft_Email - Current User Connector.app (succeeded)                                                              
- Microsoft_Email - Microsoft 365 Connector Tests.app (succeeded)
- Microsoft_Email - Microsoft 365 Connector.app (succeeded)
- Microsoft_Email - Outlook REST API.app (succeeded)                                                                    
- Microsoft_Email - SMTP API Test Library.app (succeeded)
- Microsoft_Email - SMTP API Tests.app (succeeded)                                                                      
- Microsoft_Email - SMTP API.app (succeeded)                                                                            
- Microsoft_Email - SMTP Connector Tests.app (succeeded)
- Microsoft_Email - SMTP Connector.app (succeeded)
- Microsoft_English language (Australia).app (succeeded)                                                                
- Microsoft_English language (Canada).app (succeeded)
- Microsoft_English language (New Zealand).app (succeeded)                                                              
- Microsoft_English language (United Kingdom).app (succeeded)
- Microsoft_English language (United States).app (succeeded)                                                            
- Microsoft_Essential Business Headlines Test.app (succeeded)
- Microsoft_Essential Business Headlines.app (succeeded)                                                                
- Microsoft_Finnish language (Finland).app (succeeded)
- Microsoft_French language (Belgium).app (succeeded)                                                                   
- Microsoft_French language (Canada).app (succeeded)
- Microsoft_French language (France).app (succeeded)                                                                    
- Microsoft_French language (Switzerland).app (succeeded)                                                               
- Microsoft_German language (Austria).app (succeeded)
- Microsoft_German language (Germany).app (succeeded)                                                                   
- Microsoft_German language (Switzerland).app (succeeded)
- Microsoft_Icelandic language (Iceland).app (succeeded)                                                                
- Microsoft_Intrastat Core Tests.app (succeeded)
- Microsoft_Intrastat Core.app (succeeded)                                                                              
- Microsoft_Intrastat DE.app (succeeded)                                                                                
- Microsoft_Italian language (Italy).app (succeeded)
- Microsoft_Italian language (Switzerland).app (succeeded)                                                              
- Microsoft_Late Payment Prediction Tests.app (succeeded)
- Microsoft_Late Payment Prediction.app (succeeded)                                                                     
- Microsoft_Library Assert.app (succeeded)
- Microsoft_Library Outlook REST API.app (succeeded)                                                                    
- Microsoft_Library Variable Storage.app (succeeded)
- Microsoft_Library-NoTransactions.app (succeeded)                                                                      
- Microsoft_Norwegian language (Norway).app (succeeded)                                                                 
- Microsoft_OnPrem Permissions DACH.app (succeeded)
- Microsoft_OnPrem Permissions Tests.app (succeeded)                                                                    
- Microsoft_OnPrem Permissions.app (succeeded)
- Microsoft_Payment Links to PayPal.app (succeeded)
- Microsoft_PayPal Payments Standard Tests.app (succeeded)                                                              
- Microsoft_Performance Toolkit Samples.app (succeeded)                                                                 
- Microsoft_Performance Toolkit Tests.app (succeeded)
- Microsoft_Performance Toolkit.app (succeeded)                                                                         
- Microsoft_Permissions Mock.app (succeeded)
- Microsoft_Prevent Metadata Updates.app (succeeded)                                                                    
- Microsoft_Recommended Apps Tests.app (succeeded)                                                                      
- Microsoft_Recommended Apps.app (succeeded)                                                                            
- Microsoft_Report Layouts Tests.app (succeeded)                                                                        
- Microsoft_Russian language (Russia).app (succeeded)
- Microsoft_Sales and Inventory Forecast Tests.app (succeeded)                                                          
- Microsoft_Sales and Inventory Forecast.app (succeeded)
- Microsoft_Send To Email Printer.app (succeeded)                                                                       
- Microsoft_Service Declaration Tests.app (succeeded)
- Microsoft_Service Declaration.app (succeeded)                                                                         
- Microsoft_Shopify Connector Test.app (succeeded)                                                                      
- Microsoft_Shopify Connector.app (succeeded)
- Microsoft_Simplified Bank Statement Import Test.app (succeeded)                                                       
- Microsoft_Simplified Bank Statement Import.app (succeeded)
- Microsoft_Spanish language (Mexico).app (succeeded)                                                                   
- Microsoft_Spanish language (Spain).app (succeeded)
- Microsoft_Swedish language (Sweden).app (succeeded)                                                                   
- Microsoft_System Application Test Library.app (succeeded)                                                             
- Microsoft_System Application Test.app (succeeded)
- Microsoft_System Application.app (succeeded)                                                                          
- Microsoft_Test Runner.app (succeeded)
- Microsoft_Tests-Bank.app (succeeded)
- Microsoft_Tests-Cash Flow.app (succeeded)                                                                             
- Microsoft_Tests-Cost Accounting.app (succeeded)                                                                       
- Microsoft_Tests-CRM integration.app (succeeded)
- Microsoft_Tests-Data Exchange.app (succeeded)
- Microsoft_Tests-Dimension.app (succeeded)                                                                             
- Microsoft_Tests-ERM.app (succeeded)                                                                                   
- Microsoft_Tests-Fixed Asset.app (succeeded)
- Microsoft_Tests-General Journal.app (succeeded)                                                                       
- Microsoft_Tests-Graph.app (succeeded)
- Microsoft_Tests-Integration.app (succeeded)                                                                           
- Microsoft_Tests-Invoicing.app (succeeded)
- Microsoft_Tests-Job.app (succeeded)                                                                                   
- Microsoft_Tests-Local.app (succeeded)
- Microsoft_Tests-Marketing.app (succeeded)                                                                             
- Microsoft_Tests-Misc.app (succeeded)
- Microsoft_Tests-Monitor Sensitive Fields.app (succeeded)                                                              
- Microsoft_Tests-Permissions.app (succeeded)
- Microsoft_Tests-Physical Inventory.app (succeeded)                                                                    
- Microsoft_Tests-Prepayment.app (succeeded)
- Microsoft_Tests-Rapid Start.app (succeeded)                                                                           
- Microsoft_Tests-Report.app (succeeded)                                                                                
- Microsoft_Tests-Resource.app (succeeded)
- Microsoft_Tests-Reverse.app (succeeded)
- Microsoft_Tests-SCM.app (succeeded)                                                                                   
- Microsoft_Tests-SINGLESERVER.app (succeeded)                                                                          
- Microsoft_Tests-SMB.app (succeeded)
- Microsoft_Tests-TestLibraries.app (succeeded)                                                                         
- Microsoft_Tests-Upgrade.app (succeeded)
- Microsoft_Tests-User.app (succeeded)                                                                                  
- Microsoft_Tests-VAT.app (succeeded)
- Microsoft_Tests-Workflow.app (succeeded)                                                                              
- Microsoft_Troubleshoot FA Ledger Entries.app (succeeded)
- Microsoft_Universal Print Integration.app (succeeded)                                                                 
- Microsoft_WorldPay Payments Standard Tests.app (succeeded)
- Microsoft_WorldPay Payments Standard.app (succeeded)                                                                  
- System.app (succeeded)
::endgroup::
Enumerating Apps in Symbols Folder ***\AppData\Local\Temp\d7a60887-5d5f-4488-892e-f26c02e1e2ba      
::group::Getting .app info ***\AppData\Local\Temp\d7a60887-5d5f-4488-892e-f26c02e1e2ba\cache_AppInfo.json
- orderbase consulting GmbH_orderbase Base Library_23.4.36.198_RUNTIME-21.0.app (succeeded)                             
- orderbase consulting GmbH_orderbase Time Management - PDA Service_23.4.20.252_RUNTIME-21.0.app (succeeded)
- orderbase consulting GmbH_orderbase Time Management Library_23.4.48.412_RUNTIME-21.0.app (succeeded)                  
- TRASER Software GmbH_TRASER Checklists_2102.230600.20231124.1_SAAS.app (succeeded)                                    
- TRASER Software GmbH_TRASER Core_2102.231100.20231213.1_SAAS.app (succeeded)
- TRASER Software GmbH_TRASER DMS Machine_2102.230900.20231201.1_SAAS.app (succeeded)                                   
- TRASER Software GmbH_TRASER DMS_2103.230900.20231130.1_SAAS.app (succeeded)                                           
- TRASER Software GmbH_TRASER Interface_2001.230300.20231124.2_SAAS.app (succeeded)                                     
- TRASER Software GmbH_TRASER License_2102.230600.20231124.4_SAAS.app (succeeded)
- TRASER Software GmbH_TRASER Storage_2001.230900.20231128.1_SAAS.app (succeeded)                                       
::endgroup::                                                                                                            
Processing dependency Microsoft_Application_21.2.49946.49990 ()                                                         
Dependency App not found                                                                                                
Copying C:\ProgramData\BcContainerHelper\compiler\1fcd6ebe-b335-4144-bc74-81939aabc4bf\symbols\Microsoft_Application.app to ***\AppData\Local\Temp\d7a60887-5d5f-4488-892e-f26c02e1e2ba
Adding dependency to System Application from Microsoft
Adding dependency to Base Application from Microsoft
Processing dependency Microsoft_System_21.0.49939.49984 ()                                                              
Dependency App not found
Copying C:\ProgramData\BcContainerHelper\compiler\1fcd6ebe-b335-4144-bc74-81939aabc4bf\symbols\System.app to ***\AppData\Local\Temp\d7a60887-5d5f-4488-892e-f26c02e1e2ba
Processing dependency orderbase consulting GmbH_orderbase Base Library_23.4.36.198 (a09be25f-97a6-44a9-8203-f252ad7efbb9)
Dependency App exists                                                                                                   
Processing dependency orderbase consulting GmbH_orderbase Time Management Library_23.4.48.412 (6c9adc1f-301e-433f-96fd-56af29b1a71f)
Dependency App exists                                                                                                   
Processing dependency orderbase consulting GmbH_orderbase Time Management - PDA Service_23.4.20.252 (a3414767-55fc-4ef5-a053-c3172ebf5aee)
Dependency App exists                                                                                                   
Processing dependency TRASER Software GmbH_TRASER Storage_2001.230900.20231128.1 (bb6e9331-210f-4241-b3e1-5f8d2acc79e8) 
Dependency App exists                                                                                                   
Processing dependency TRASER Software GmbH_TRASER Core_2102.231100.20231213.1 (f661ac2d-92c0-472c-810a-ec8ea3044603)    
Dependency App exists                                                                                                   
Processing dependency TRASER Software GmbH_TRASER DMS Machine_2102.230900.20231201.1 (25e7d5c1-1369-4018-8344-78cc87b8d440)
Dependency App exists                                                                                                   
Processing dependency TRASER Software GmbH_TRASER DMS_2103.230900.20231130.1 (5602a8b3-2c2f-40c6-865b-4250c316f125)     
Dependency App exists                                                                                                   
Processing dependency Microsoft_System Application_21.2.49946.49990 (63ca2fa4-4f03-4f2b-a480-172fef340d3f)
Dependency App not found                                                                                                
Copying C:\ProgramData\BcContainerHelper\compiler\1fcd6ebe-b335-4144-bc74-81939aabc4bf\symbols\Microsoft_System Application.app to ***\AppData\Local\Temp\d7a60887-5d5f-4488-892e-f26c02e1e2ba
Processing dependency Microsoft_Base Application_21.2.49946.49990 (437dbf0e-84ff-417a-965d-ed2bb9650972)
Dependency App not found                                                                                                
Copying C:\ProgramData\BcContainerHelper\compiler\1fcd6ebe-b335-4144-bc74-81939aabc4bf\symbols\Microsoft_Base Application.app to ***\AppData\Local\Temp\d7a60887-5d5f-4488-892e-f26c02e1e2ba
Platform version: 21.0.49939.49984
Modifying Dependencies                                                                                                  
Dependency: Id=a09be25f-97a6-44a9-8203-f252ad7efbb9, Publisher=orderbase consulting GmbH, Name=orderbase Base Library, Version=23.4.36.198
Dependency: Id=6c9adc1f-301e-433f-96fd-56af29b1a71f, Publisher=orderbase consulting GmbH, Name=orderbase Time Management Library, Version=23.4.48.412
Dependency: Id=a3414767-55fc-4ef5-a053-c3172ebf5aee, Publisher=orderbase consulting GmbH, Name=orderbase Time Management - PDA Service, Version=23.4.20.252
Dependency: Id=bb6e9331-210f-4241-b3e1-5f8d2acc79e8, Publisher=TRASER Software GmbH, Name=TRASER Storage, Version=2001.230900.20231128.1
Dependency: Id=f661ac2d-92c0-472c-810a-ec8ea3044603, Publisher=TRASER Software GmbH, Name=TRASER Core, Version=2102.231100.20231213.1
Dependency: Id=25e7d5c1-1369-4018-8344-78cc87b8d440, Publisher=TRASER Software GmbH, Name=TRASER DMS Machine, Version=2102.230900.20231201.1
Dependency: Id=5602a8b3-2c2f-40c6-865b-4250c316f125, Publisher=TRASER Software GmbH, Name=TRASER DMS, Version=2103.230900.20231130.1
Application Dependency 21.2.49946.49990                                                                                 
Platform Dependency 21.0.49939.49984
Compiling...                                                                                                            
.\alc.exe /project:"***\Product\TSR-orderbase-Time-Management-Traser-Library\Time Management Traser" /packagecachepath:"***\AppData\Local\Temp\d7a60887-5d5f-4488-892e-f26c02e1e2ba" /out:".\out\TRASER Software GmbH_TRASER DMS 365 x orderbase Time Management PDA_2102.240100.0.0.app" /assemblyprobingpaths:C:\ProgramData\BcContainerHelper\compiler\1fcd6ebe-b335-4144-bc74-81939aabc4bf\dlls\OpenXML,C:\Windows\Microsoft.NET\Assembly,C:\ProgramData\BcContainerHelper\compiler\1fcd6ebe-b335-4144-bc74-81939aabc4bf\dlls\Service,C:\ProgramData\BcContainerHelper\compiler\1fcd6ebe-b335-4144-bc74-81939aabc4bf\dlls\Mock Assemblies
Microsoft (R) AL Compiler version 10.2.10.59069
Copyright (C) Microsoft Corporation. All rights reserved                                                                

Compilation started for project 'TRASER DMS 365 x orderbase Time Management PDA' containing '34' files at '17:34:05.241'.

Compilation ended at '17:34:08.951'.

Compile-AppWithBcCompilerFolder Telemetry Correlation Id: bb8b77ce-3cca-498f-83f5-f78af1485a96
Remove-Item: ***\Product\TraserBCHelper\PSModule\AppHandling\Compile-ALAppWithCompileFolder.ps1:82:56
Line |
  82 |  … et-ChildItem $appSymbolsFolder -Recurse | Remove-Item -Recurse -Force
     |                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | The process cannot access the file '***\AppData\Local\Temp\d7a60887-5d5f-4488-892e-f26c02e1e2ba\TRASER Software GmbH_TRASER Core_2102.231100.20231213.1_SAAS.app' because it   
     | is being used by another process.

Additional context

freddydk commented 8 months ago

Could you provide a dump of the build when using BcContainerHelper version 5?

lktraser commented 8 months ago

Certainly:

Setting sqlMemoryLimit = 8G
Setting GenerateImages = False
Setting memoryLimit = 
Setting isolation = process
Setting sandboxContainersAreMultitenantByDefault = False
TraserBCHelper version 1.20240216.1
BcContainerHelper version 5.0.3
Setting sandboxContainersAreMultitenantByDefault = False
BC.HelperFunctions emits usage statistics telemetry to Microsoft

*** Download to symbols folder output ***

using 7zip
Using Symbols Folder: C:\Users\Administrator\AppData\Local\Temp\a3cbeac2-283f-4496-be4a-0c9ec826572e
Enumerating Apps in CompilerFolder C:\ProgramData\BcContainerHelper\compiler\e68a683b-194d-4cf5-b07d-0c01bcacd785\symbols
Enumerating Apps in Symbols Folder C:\Users\Administrator\AppData\Local\Temp\a3cbeac2-283f-4496-be4a-0c9ec826572e
Processing dependency Microsoft_Application_21.2.49946.49990 ()
Dependency App not found
Copying C:\ProgramData\BcContainerHelper\compiler\e68a683b-194d-4cf5-b07d-0c01bcacd785\symbols\Microsoft_Application.app to C:\Users\Administrator\AppData\Local\Temp\a3cbeac2-283f-4496-be4a-0c9ec826572e
Adding dependency to System Application from Microsoft
Adding dependency to Base Application from Microsoft
Processing dependency Microsoft_System_21.0.49939.49984 ()
Dependency App not found
Copying C:\ProgramData\BcContainerHelper\compiler\e68a683b-194d-4cf5-b07d-0c01bcacd785\symbols\System.app to C:\Users\Administrator\AppData\Local\Temp\a3cbeac2-283f-4496-be4a-0c9ec826572e
Processing dependency orderbase consulting GmbH_orderbase Base Library_23.4.36.198 (a09be25f-97a6-44a9-8203-f252ad7efbb9)
Dependency App exists
Processing dependency orderbase consulting GmbH_orderbase Time Management Library_23.4.48.412 (6c9adc1f-301e-433f-96fd-56af29b1a71f)
Dependency App exists
Processing dependency orderbase consulting GmbH_orderbase Time Management - PDA Service_23.4.20.252 (a3414767-55fc-4ef5-a053-c3172ebf5aee)
Dependency App exists
Processing dependency TRASER Software GmbH_TRASER Storage_2001.230900.20231128.1 (bb6e9331-210f-4241-b3e1-5f8d2acc79e8)
Dependency App exists
Processing dependency TRASER Software GmbH_TRASER Core_2102.231100.20231213.1 (f661ac2d-92c0-472c-810a-ec8ea3044603)
Dependency App exists
Processing dependency TRASER Software GmbH_TRASER DMS Machine_2102.230900.20231201.1 (25e7d5c1-1369-4018-8344-78cc87b8d440)
Dependency App exists
Processing dependency TRASER Software GmbH_TRASER DMS_2103.230900.20231130.1 (5602a8b3-2c2f-40c6-865b-4250c316f125)
Dependency App exists
Processing dependency Microsoft_System Application_21.2.49946.49990 (63ca2fa4-4f03-4f2b-a480-172fef340d3f)
Dependency App not found
Copying C:\ProgramData\BcContainerHelper\compiler\e68a683b-194d-4cf5-b07d-0c01bcacd785\symbols\Microsoft_System Application.app to C:\Users\Administrator\AppData\Local\Temp\a3cbeac2-283f-4496-be4a-0c9ec826572e
Processing dependency Microsoft_Base Application_21.2.49946.49990 (437dbf0e-84ff-417a-965d-ed2bb9650972)
Dependency App not found
Copying C:\ProgramData\BcContainerHelper\compiler\e68a683b-194d-4cf5-b07d-0c01bcacd785\symbols\Microsoft_Base Application.app to C:\Users\Administrator\AppData\Local\Temp\a3cbeac2-283f-4496-be4a-0c9ec826572e
Platform version: 21.0.49939.49984
Modifying Dependencies
Dependency: Id=a09be25f-97a6-44a9-8203-f252ad7efbb9, Publisher=orderbase consulting GmbH, Name=orderbase Base Library, Version=23.4.36.198
Dependency: Id=6c9adc1f-301e-433f-96fd-56af29b1a71f, Publisher=orderbase consulting GmbH, Name=orderbase Time Management Library, Version=23.4.48.412
Dependency: Id=a3414767-55fc-4ef5-a053-c3172ebf5aee, Publisher=orderbase consulting GmbH, Name=orderbase Time Management - PDA Service, Version=23.4.20.252
Dependency: Id=bb6e9331-210f-4241-b3e1-5f8d2acc79e8, Publisher=TRASER Software GmbH, Name=TRASER Storage, Version=2001.230900.20231128.1
Dependency: Id=f661ac2d-92c0-472c-810a-ec8ea3044603, Publisher=TRASER Software GmbH, Name=TRASER Core, Version=2102.231100.20231213.1
Dependency: Id=25e7d5c1-1369-4018-8344-78cc87b8d440, Publisher=TRASER Software GmbH, Name=TRASER DMS Machine, Version=2102.230900.20231201.1
Dependency: Id=5602a8b3-2c2f-40c6-865b-4250c316f125, Publisher=TRASER Software GmbH, Name=TRASER DMS, Version=2103.230900.20231130.1
Application Dependency 21.2.49946.49990
Platform Dependency 21.0.49939.49984
Compiling...
.\alc.exe /project:"C:\hub3agent04\A1\_work\237\s\Time Management Traser" /packagecachepath:"C:\Users\Administrator\AppData\Local\Temp\a3cbeac2-283f-4496-be4a-0c9ec826572e" /out:"C:\hub3agent04\A1\_work\237\a\TRASER Software GmbH_TRASER DMS 365 x orderbase Time Management PDA_2102.240100.20240221.1.app" /analyzer:C:\ProgramData\BcContainerHelper\compiler\e68a683b-194d-4cf5-b07d-0c01bcacd785\compiler\extension\bin\Analyzers\Microsoft.Dynamics.Nav.CodeCop.dll /analyzer:C:\ProgramData\BcContainerHelper\compiler\e68a683b-194d-4cf5-b07d-0c01bcacd785\compiler\extension\bin\Analyzers\Microsoft.Dynamics.Nav.UICop.dll /assemblyprobingpaths:C:\ProgramData\BcContainerHelper\compiler\e68a683b-194d-4cf5-b07d-0c01bcacd785\dlls\OpenXML,C:\Windows\Microsoft.NET\Assembly,C:\ProgramData\BcContainerHelper\compiler\e68a683b-194d-4cf5-b07d-0c01bcacd785\dlls\Service,C:\ProgramData\BcContainerHelper\compiler\e68a683b-194d-4cf5-b07d-0c01bcacd785\dlls\Mock Assemblies
Microsoft (R) AL Compiler version 10.2.10.59069
Copyright (C) Microsoft Corporation. All rights reserved

*** Compiler Output ***

Compilation ended at '18:59:12.216'.
lktraser commented 8 months ago

Hi @freddydk, I just read about the new changes to generic images on yammer and the deadline of the 25th is already drawing pretty close. This issue is keeping us from upgrading to latest bccontainerhelper. I'm afraid we will be completely blocked if it's not resolved.

freddydk commented 8 months ago

Sorry - I will have a look at this tomorrow. Thanks for raising the flag.

freddydk commented 8 months ago

Sorry, I cannot repro this

This file: TraserBCHelper\PSModule\AppHandling\Compile-ALAppWithCompileFolder.ps1:82:56 is your own (not part of ContainerHelper)

It looks like you are using Get-ChildItem -Recurse | Remove-Item -Recurse -Force

That is a double recurse and might be what causes the problem for you. It might be that the structure is different, but the failing code seems to be your own.

lktraser commented 8 months ago

Hi Freddy, while it is my own script I posted the containing code above and it's basically just creating and removing the symbols folder before and after

$compilefolder = New-BcCompilerFolder -artifactUrl $artifactUrl $output = Compile-AppWithBcCompilerFolder @compileparameters -compilerFolder $compilefolder

My remove is just Remove-Item -Path $appSymbolsFolder -Recurse -Force why do you suspect I use Get-ChildItem -Recurse | Remove-Item -Recurse -Force

Further help would be appreciated, this is important to us so our build server isn't flooded with build leftovers.

freddydk commented 8 months ago

image

I will be out next week (from today at 3pm) - but we can grab a Teams call this morning to troubleshoot?

Before the Teams call - I would like to get a copy of your scripts to see if anything springs into mind - and maybe modify it to identify what the problem actually is and through that figure out whether I need to change anything.

I am open at 11am - feel free to invite freddyk at microsoft dot com.

Thanks

freddydk commented 8 months ago

Also, the difference between this:

Get-ChildItem $appSymbolsFolder -Recurse | Remove-Item -Recurse -Force

and

Remove-Item $appSymbolsFolder -Recurse -Force

is that the first one is trying to empty the folder - the second is trying to delete the folder.

I would empty the folder without the first -recurse

Get-ChildItem -Path $appSymbolsFolder -Include * | Remove-Item -Recurse -Force
lktraser commented 8 months ago

Hi Freddy, I think I can save you time. I upgraded to 6.0.11 just now to make sure nothing has changed in the meantime and from what I can tell the issue is resolved. I didn't change my script but it seems like something changed about the locking process between 6.0.4 and 6.0.11. I'll run the buildserver that way for now.

I'll keep an eye out for it and worst case I'll remove my cleanup code temporarily.

Also thanks for the advice on the cleanup code I'll incorporate that if the issue turns up again.

Thanks as always for your time.

lktraser commented 8 months ago

Sadly I was too hasty in calling it off afterall. The issue returned on 6.0.11. I tried all different versions of Remove-Item but all turn up the same problem.

Get-ChildItem -Path $appSymbolsFolder -Include * | Remove-Item -Force

Compilation ended at '16:18:14.153'.

***\Product\TraserBCHelper\out\TRASER Software ***.app successfully created in 7 seconds
Remove-Item : Cannot remove item ***\AppData\Local\Temp\8f13a913-fc47-458f-85cc-1697f0f05978\Continia 
Software_Continia OPplus_23.2.1.531556_RUNTIME-23.0.app: The process cannot access the file
'***\AppData\Local\Temp\8f13a913-fc47-458f-85cc-1697f0f05978\Continia Software_Continia
OPplus_23.2.1.531556_RUNTIME-23.0.app' because it is being used by another process.
At ***\Product\TraserBCHelper\PSModule\AppHandling\Compile-ALAppWithCompileFolder.ps1:78 char:60        
+ ... Get-ChildItem -Path $appSymbolsFolder -Include * | Remove-Item -Force
+                                                        ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (C:\Users\LeonKn...UNTIME-23.0.app:FileInfo) [Remove-Item], IOException
    + FullyQualifiedErrorId : RemoveFileSystemItemIOError,Microsoft.PowerShell.Commands.RemoveItemCommand

I really can only isolate it to bccontainerhelper 6 + runtime packages in the appSymbolsFolder. To reduce variables I've also reduced it to pure bccontainerhelper and manual delete with windows explorer.

So the script is simply: $output = Compile-AppWithBcCompilerFolder -compilerFolder $compilefolder -appProjectFolder (Resolve-Path '.** - App\') -appSymbolsFolder '***\Desktop\symbols'

And leads to: image

I'll revert to version 5 for now as I will be on vacation too.

freddydk commented 7 months ago

I will need a repro with everything in order to fix this. I have tried in various ways to create runtime packages, compile and delete - and I cannot repro this, So basically, I will need a .zip file with a test project or like, on which I can run a command that reproduces this - else I cannot fix the issue. and please note, BcContainerHelper 5 will stop working next week (maybe not with compilerfolders - but definitely with containers)