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

Unsupported symbol type 393317 #1898

Closed sauerkreut closed 3 years ago

sauerkreut commented 3 years ago

Hello

re: https://github.com/microsoft/navcontainerhelper/issues/1678 we still have the issue with BcContainerHelper 2.0.11

Describe the issue While "Installing apps" we get the error message: Unsupported symbol type 393317

Scripts used to create container and cause the issue

Param(
    [Parameter(Mandatory=$false)]
    [string] $version = "ci",
    [Parameter(Mandatory=$false)]
    [int] $appBuild = 0,
    [Parameter(Mandatory=$false)]
    [int] $appRevision = 0,
    [Parameter(Mandatory=$false)]
    [string] $baseFolder,
    [Parameter(Mandatory=$false)]
    [string] $settingsFileName
)
#$localMode = $true
$buildArtifactFolder = $ENV:BUILD_ARTIFACTSTAGINGDIRECTORY
if ($baseFolder -eq ''){
    $baseFolder = (Get-Item (Join-Path $PSScriptRoot "..")).FullName
}
Write-Host "Base Folder: "
Write-Host $baseFolder

. (Join-Path $PSScriptRoot "Read-Settings.ps1") -version $version -settingsFileName $settingsFileName
if (-not $localMode){
    . (Join-Path $PSScriptRoot "Install-BcContainerHelper.ps1") -bcContainerHelperVersion $bcContainerHelperVersion -genericImageName $genericImageName
}

if ((!$appFolders) -and (!$testFolders)){
    Write-Host "Auto discover apps: "
    #$appFolders = Get-ChildItem -Path $baseFolder -Filter app.json -Recurse|Select-Object DirectoryName
    $appFolders = @()
    $testFolders = @()
    foreach($f in Get-ChildItem -Path $baseFolder -Filter app.json -Recurse){
        if ($f.DirectoryName.Length -gt $baseFolder.Length){
            $subfolder = $f.DirectoryName.Substring($baseFolder.Length+1)
            if ($subfolder.ToLower().EndsWith("test")){
                $testFolders += $subfolder
            }
            else
            {
                $appFolders += $subfolder
            }
        }
    }
    Write-Host
    Write-Host "----------------------------------------------"
    Write-Host "App Folders:"
    Write-Host "----------------------------------------------"
    $appFolders|Format-List
    Write-Host
    Write-Host "----------------------------------------------"
    Write-Host "Test Folders:"
    Write-Host "----------------------------------------------"
    $testFolders|Format-List
}
if ($enableAppSourceCop){
    Write-Host "Backup AppSourceCop.json files"
    foreach($f in Get-ChildItem -Path $baseFolder -Filter AppSourceCop.json -Recurse){
        Write-Host $f.FullName
        Rename-Item -Path $f.FullName -NewName "$($f.FullName).bak"
    }
}

$params = @{}
$insiderSasToken = "$ENV:insiderSasToken"
$licenseFile = "$ENV:licenseFile"
$codeSigncertPfxFile = "$ENV:CodeSignCertPfxFile"
if (!$doNotSignApps -and $codeSigncertPfxFile) {
    if ("$ENV:CodeSignCertPfxPassword" -ne "") {
        $codeSignCertPfxPassword = try { "$ENV:CodeSignCertPfxPassword" | ConvertTo-SecureString } catch { ConvertTo-SecureString -String "$ENV:CodeSignCertPfxPassword" -AsPlainText -Force }
        $params = @{
            "codeSignCertPfxFile" = $codeSignCertPfxFile
            "codeSignCertPfxPassword" = $codeSignCertPfxPassword
        }
    }
    else {
        $codeSignCertPfxPassword = $null
    }
}

$allTestResults = "testresults*.xml"
$testResultsFile = Join-Path $baseFolder "TestResults.xml"
$testResultsFiles = Join-Path $baseFolder $allTestResults
if (Test-Path $testResultsFiles) {
    Remove-Item $testResultsFiles -Force
}

$fobFiles = @()
$NewBcContainer = $null
if ($fobFileFolders){
    $buildRoot = (Get-Item (Join-Path $PSScriptRoot "..\")).FullName
    foreach($fobFileFolder in $fobFileFolders){
        Write-Host "Fob File Folder: $fobFileFolder" -ForegroundColor Cyan
        $fobFileFolderFullPath = Join-Path $buildRoot $fobFileFolder
        #Write-Host "Fob File Folder Full: $fobFileFolderFullPath" -ForegroundColor Cyan
        foreach($f in Get-ChildItem -Path $fobFileFolderFullPath -Filter *.fob -Recurse){
            Write-Host $f
            $fobFiles += $f.FullName
        }
    }
    $fobFiles|Format-Table

    $NewBcContainer = {
        Param([Hashtable]$parameters)
        Write-Host "New BC Container on the way...";
        $parameters += @{"enableSymbolLoading" = $true};
        New-BcContainer @parameters;
        Invoke-ScriptInBcContainer $parameters.ContainerName -scriptblock { $progressPreference = 'SilentlyContinue' };
        Write-Host "Container is ready..." -ForegroundColor Green;
        Start-Sleep -Seconds 90
        foreach ($fobFile in $fobFiles){
            Write-Host "Importing fob file $fobFile...";
            Import-ObjectsToNavContainer -objectsFile $fobFile -containerName $containerName -ImportAction Overwrite -SynchronizeSchemaChanges Force
            Write-Host "Fob file imported.";
        }
        Write-Host "Generating Symbol Refs...";
        Generate-SymbolsInNavContainer -containerName $containerName;
        Write-Host "Symbol Refs. generated.";
    }
} else {
    Write-Host "No fob files folder specified. Go ahead as usual..."
}

$CompileAppInBcContainer = $null
if ($enableAppSourceCop){
    $CompileAppInBcContainer = {
        Param([Hashtable]$parameters)
        $appFolder = $parameters.appProjectFolder
        $appSourceCopJsonFile = Join-Path $appFolder "AppSourceCop.json"
        $appSourceCopJsonFileBackup = "${appSourceCopJsonFile}.bak"
        if (Test-Path -Path $appSourceCopJsonFileBackup -PathType leaf) {
            if (Test-Path -Path $appSourceCopJsonFile -PathType leaf) {
                Remove-Item -Path $appSourceCopJsonFile
            }
            Rename-Item -Path $appSourceCopJsonFileBackup -NewName "AppSourceCop.json"
        }
        Compile-AppInBcContainer @parameters
    }
}

$transscriptFullName = (Join-Path $PSScriptRoot "transcript.txt")

Start-Transcript -Path $transscriptFullName

Run-AlPipeline @params `
    -pipelinename $pipelineName `
    -containerName $containerName `
    -imageName $imageName `
    -artifact $artifact.replace('{INSIDERSASTOKEN}',$insiderSasToken) `
    -memoryLimit $memoryLimit `
    -baseFolder $baseFolder `
    -licenseFile $LicenseFile `
    -installApps $installApps `
    -previousApps $previousApps `
    -appFolders $appFolders `
    -testFolders $testFolders `
    -doNotRunTests:$doNotRunTests `
    -testResultsFile $testResultsFile `
    -testResultsFormat 'JUnit' `
    -installTestFramework:$installTestFramework `
    -installTestLibraries:$installTestLibraries `
    -installPerformanceToolkit:$installPerformanceToolkit `
    -enableCodeCop:$enableCodeCop `
    -enableAppSourceCop:$enableAppSourceCop `
    -enablePerTenantExtensionCop:$enablePerTenantExtensionCop `
    -enableUICop:$enableUICop `
    -AppSourceCopMandatoryAffixes $appSourceCopMandatoryAffixes `
    -AppSourceCopSupportedCountries $appSourceCopSupportedCountries `
    -escapeFromCops `
    -additionalCountries $additionalCountries `
    -buildArtifactFolder $buildArtifactFolder `
    -CreateRuntimePackages:$CreateRuntimePackages `
    -appBuild $appBuild -appRevision $appRevision `
    -NewBcContainer $NewBcContainer `
    -CompileAppInBcContainer $CompileAppInBcContainer    

Stop-Transcript

. (Join-Path $PSScriptRoot "AnalyzeTranscript.ps1") -version $version -settingsFileName $settingsFileName

Write-Host "##vso[task.setvariable variable=TestResults]$allTestResults"

Full output of scripts

BcContainerHelper is version 2.0.11
BcContainerHelper is running as ***istrator
Host is Microsoft Windows Server 2019 Datacenter - ltsc2019
Docker Client Version is 20.10.4
Docker Server Version is 20.10.4
Downloading application artifact /sandbox/18.0.23013.24771/de
Downloading C:\Users\VssAdministrator\AppData\Local\Temp\62a94c57-f57a-474a-85c2-b77633db1f5c.zip
Unpacking application artifact to tmp folder using 7zip
Downloading platform artifact /sandbox/18.0.23013.24771/platform
Downloading C:\Users\VssAdministrator\AppData\Local\Temp\dc771a15-7a73-4287-86a8-9e8e2aa8c259.zip
Unpacking platform artifact to tmp folder using 7zip
Downloading Prerequisite Components
Downloading c:\bcartifacts.cache\sandbox\18.0.23013.24771\platform\Prerequisite Components\Open XML SDK 2.5 for Microsoft Office\OpenXMLSDKv25.msi
Downloading c:\bcartifacts.cache\sandbox\18.0.23013.24771\platform\Prerequisite Components\IIS URL Rewrite Module\rewrite_2.0_rtw_x64.msi
Downloading c:\bcartifacts.cache\sandbox\18.0.23013.24771\platform\Prerequisite Components\DotNetCore\DotNetCore.1.0.4_1.1.1-WindowsHosting.exe
Fetching all docker images
Fetching all docker volumes
Using image mcr.microsoft.com/businesscentral:10.0.17763.1879
Creating Container hostedagent-allapps-latest
Version: 18.0.23013.24771-DE
Style: sandbox
Multitenant: Yes
Platform: 18.0.22893.24763
Generic Tag: 1.0.1.6
Container OS Version: 10.0.17763.1879 (ltsc2019)
Host OS Version: 10.0.17763.1879 (ltsc2019)
Using process isolation
Using locale de-DE
Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable)
Using license file https://comporsystransfer.file.core.windows.net/transfer/License/BC17/comporsys.flf
Downloading C:\ProgramData\BcContainerHelper\Extensions\hostedagent-allapps-latest\my\license.flf
Additional Parameters:
--volume "D:\a\1\s:c:\sources"
--env customNavSettings=EnableTaskScheduler=False
Files in C:\ProgramData\BcContainerHelper\Extensions\hostedagent-allapps-latest\my:
- AdditionalOutput.ps1
- license.flf
- MainLoop.ps1
- SetupVariables.ps1
- updatehosts.ps1
Creating container hostedagent-allapps-latest from image mcr.microsoft.com/businesscentral:10.0.17763.1879
9f4d56e52f10d024db357a521c82e6eb2594bf7326526f7c3874c26a9c225f82
Waiting for container hostedagent-allapps-latest to be ready
Adding HOSTEDAGENT-ALL to hosts file
Using artifactUrl https://bcartifacts.azureedge.net/sandbox/18.0.23013.24771/de
Using installer from C:\Run\150-new
Installing Business Central
Installing from artifacts
Starting Local SQL Server
Starting Internet Information Server
Copying Service Tier Files
c:\dl\sandbox\18.0.23013.24771\platform\ServiceTier\Program Files
c:\dl\sandbox\18.0.23013.24771\platform\ServiceTier\System64Folder
Copying PowerShell Scripts
c:\dl\sandbox\18.0.23013.24771\platform\WindowsPowerShellScripts\Cloud\NAVAdministration
c:\dl\sandbox\18.0.23013.24771\platform\WindowsPowerShellScripts\WebSearch
Copying dependencies
Copying ReportBuilder
Importing PowerShell Modules
Determining Database Collation from c:\dl\sandbox\18.0.23013.24771\de\BusinessCentral-DE.bak
Restoring CRONUS Demo Database
Setting CompatibilityLevel for tenant on localhost\SQLEXPRESS
Creating Business Central Service Tier
Installing SIP crypto provider: 'C:\Windows\System32\NavSip.dll'
Copying Web Client Files
c:\dl\sandbox\18.0.23013.24771\platform\WebClient\Microsoft Dynamics NAV
Copying Client Files
c:\dl\sandbox\18.0.23013.24771\platform\LegacyDlls\program files\Microsoft Dynamics NAV
c:\dl\sandbox\18.0.23013.24771\platform\LegacyDlls\program files\Microsoft Dynamics NAV
c:\dl\sandbox\18.0.23013.24771\platform\LegacyDlls\systemFolder
Copying ModernDev Files
c:\dl\sandbox\18.0.23013.24771\platform
c:\dl\sandbox\18.0.23013.24771\platform\ModernDev\program files\Microsoft Dynamics NAV
Copying additional files
Copying ConfigurationPackages
C:\dl\sandbox\18.0.23013.24771\platform\ConfigurationPackages
Copying Test Assemblies
C:\dl\sandbox\18.0.23013.24771\platform\Test Assemblies
Copying Extensions
C:\dl\sandbox\18.0.23013.24771\de\Extensions
Copying Applications
C:\dl\sandbox\18.0.23013.24771\platform\Applications
Copying Applications.DE
C:\dl\sandbox\18.0.23013.24771\de\Applications.DE
Starting Business Central Service Tier
Importing license file
Copying Database on localhost\SQLEXPRESS from tenant to default
Taking database tenant offline
Copying database files
Attaching files as new Database default
Putting database tenant back online
Mounting tenant database
Mounting Database for default on server localhost\SQLEXPRESS with AllowAppDatabaseWrite = False
Sync'ing Tenant
Copying Applications
C:\dl\sandbox\18.0.23013.24771\platform\Applications
Copying Applications.DE
C:\dl\sandbox\18.0.23013.24771\de\Applications.DE
Starting Business Central Service Tier
Importing license file
Copying Database on localhost\SQLEXPRESS from tenant to default
Taking database tenant offline
Copying database files
Attaching files as new Database default
Putting database tenant back online
Mounting tenant database
Mounting Database for default on server localhost\SQLEXPRESS with AllowAppDatabaseWrite = False
Sync'ing Tenant
Tenant is Operational
Stopping Business Central Service Tier
Installation took 283 seconds
Installation complete
Initializing...
Setting host.containerhelper.internal to 172.27.48.1 in container hosts file
Starting Container
Hostname is hostedagent-allapps-latest
PublicDnsName is hostedagent-allapps-latest
Using NavUserPassword Authentication
Creating Self Signed Certificate
Self Signed Certificate Thumbprint XXX
Modifying Service Tier Config File with Instance Specific Settings
Modifying Service Tier Config File with settings from environment variable
Setting EnableTaskScheduler to False
Starting Service Tier
Registering event sources
Creating DotNetCore Web Server Instance
Enabling Financials User Experience
Enabling rewrite rule: Don't rewrite system files
Enabling rewrite rule: Already have tenant specified
Enabling rewrite rule: Hostname (without port) to tenant
Using license file 'c:\run\my\license.flf'
Import License
Dismounting Tenant
Mounting Tenant
Mounting Database for default on server localhost\SQLEXPRESS with AllowAppDatabaseWrite = False
Sync'ing Tenant
Tenant is Operational
Creating http download site
Setting SA Password and enabling SA
Creating *** as SQL User and add to sys***
WARNING: This license is not compatible with this version of Business Central.
Creating SUPER user
WARNING: This license is not compatible with this version of Business Central.
WARNING: This license is not compatible with this version of Business Central.
Container IP Address: 172.27.53.91
Container Hostname  : hostedagent-allapps-latest
Container Dns Name  : hostedagent-allapps-latest
Web Client          : http://hostedagent-allapps-latest/BC/?tenant=default
Dev. Server         : http://hostedagent-allapps-latest
Dev. ServerInstance : BC
Dev. Server Tenant  : default
Setting hostedagent-allapps-latest to 172.27.53.91 in host hosts file
Setting hostedagent-allapps-latest-default to 172.27.53.91 in host hosts file
Setting hostedagent-allapps-latest-default to 172.27.53.91 in container hosts file

Files:
http://hostedagent-allapps-latest:8080/ALLanguage.vsix

Container Total Physical Memory is 7.0Gb
Container Free Physical Memory is 2.8Gb

Initialization took 46 seconds
Ready for connections!
Reading CustomSettings.config from hostedagent-allapps-latest
Creating Desktop Shortcuts for hostedagent-allapps-latest
Container hostedagent-allapps-latest successfully created

Use:
Get-BcContainerEventLog -containerName hostedagent-allapps-latest to retrieve a snapshot of the event log from the container
Get-BcContainerDebugInfo -containerName hostedagent-allapps-latest to get debug information about the container
Enter-BcContainer -containerName hostedagent-allapps-latest to open a PowerShell prompt inside the container
Remove-BcContainer -containerName hostedagent-allapps-latest to remove the container again
docker logs hostedagent-allapps-latest to retrieve information about URL's again

Creating container took 439 seconds

  _____           _        _ _ _                                     
 |_   _|         | |      | | (_)                                    
   | |  _ __  ___| |_ __ _| | |_ _ __   __ _    __ _ _ __  _ __  ___ 
   | | | '_ \/ __| __/ _` | | | | '_ \ / _` |  / _` | '_ \| '_ \/ __|
  _| |_| | | \__ \ |_ (_| | | | | | | | (_| | | (_| | |_) | |_) \__ \
 |_____|_| |_|___/\__\__,_|_|_|_|_| |_|\__, |  \__,_| .__/| .__/|___/
                                        __/ |       | |   | |        
                                       |___/        |_|   |_|        

Downloading C:\Users\VssAdministrator\AppData\Local\Temp\9a6754a1-8f91-4abd-b37e-fb655ffa4d5a
Publishing C:\ProgramData\BcContainerHelper\Extensions\hostedagent-allapps-latest\86bcb7c8-e29a-452c-be28-32d1cf6e452d\9a6754a1-8f91-4abd-b37e-fb655ffa4d5a.app
WARNING: This license is not compatible with this version of Business Central.
WARNING: The package has been built on a server with a different version than the current server version. Package: 
17.0.18204.18738, Server: 18.0.22893.24763.
Unsupported symbol type 393317
at <ScriptBlock>, <No file>: line 18
at Invoke-ScriptInBcContainer, C:\Program Files\WindowsPowerShell\Modules\BcContainerHelper\2.0.11\ContainerHandling\Invoke-ScriptInNavContainer.ps1: line 44
at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\BcContainerHelper\2.0.11\AppHandling\Publish-NavContainerApp.ps1: line 257
at Publish-BcContainerApp, C:\Program Files\WindowsPowerShell\Modules\BcContainerHelper\2.0.11\AppHandling\Publish-NavContainerApp.ps1: line 117
at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\BcContainerHelper\2.0.11\AppHandling\Run-AlPipeline.ps1: line 506
at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\BcContainerHelper\2.0.11\AppHandling\Run-AlPipeline.ps1: line 738
at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\BcContainerHelper\2.0.11\AppHandling\Run-AlPipeline.ps1: line 707
at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\BcContainerHelper\2.0.11\AppHandling\Run-AlPipeline.ps1: line 701
at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\BcContainerHelper\2.0.11\AppHandling\Run-AlPipeline.ps1: line 577
at Run-AlPipeline, C:\Program Files\WindowsPowerShell\Modules\BcContainerHelper\2.0.11\AppHandling\Run-AlPipeline.ps1: line 544
at <ScriptBlock>, D:\a\1\s\scripts\DevOps-Pipeline.ps1: line 143
at <ScriptBlock>, D:\a\_temp\6d0c6cca-d078-4169-9f4b-84442ba4ff0c.ps1: line 3
at <ScriptBlock>, <No file>: line 1

It was working till 30th March 2020.

Regards Walter

freddydk commented 3 years ago

Right above the error, it states the problem:

WARNING: The package has been built on a server with a different version than the current server version. Package: 17.0.18204.18738, Server: 18.0.22893.24763.

Runtime packages from version 17 cannot be used with version 18.

sauerkreut commented 3 years ago

Sure. Stupid me. I should have read it completely. I will close the issue.