Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling baseapp 21.x causes a compile error on .Net types #2678

Closed
RonKopp opened this issue Sep 8, 2022 · 2 comments
Closed

Compiling baseapp 21.x causes a compile error on .Net types #2678

RonKopp opened this issue Sep 8, 2022 · 2 comments

Comments

@RonKopp
Copy link

RonKopp commented Sep 8, 2022

When creating a standard BC Container based on artifact "https://BcPublicPreview.azureedge.net/sandbox/21.0.45833.0/nl" I'm unable to compile the base app. There are error in regards to the OpenXML assembly. It appears this assembly exists in 3 different locations in the C:\ProgramData\BcContainerHelper\Extensions<ContainerName>.netPackages. With 2 different versions:

  • "C:\ProgramData\BcContainerHelper\Extensions\demo21x.netPackages\assembly\DocumentFormat.OpenXml.dll" ==> version 2.5 (based on .Net framwork 4)
  • "C:\ProgramData\BcContainerHelper\Extensions\demo21x.netPackages\Open XML SDK\DocumentFormat.OpenXml.dll" ==> version 2.5 (based on .Net framwork 4)
  • "C:\ProgramData\BcContainerHelper\Extensions\demo21x.netPackages\Service\DocumentFormat.OpenXml.dll" ==> version 2.16.00 (Based on .net standard 2.0)

I solved it by hardcoded removing the assemblies from version 2.5, and only keeping the file in folder ./services.
But to my understanding this should be solved in the bccontainerhelper, or artifacts should be removed from the DVD.

Scripts used to create container and cause the issue

New-NavContainer -licenseFile $LicenseFile `
    -accept_eula `
    -containerName $ContainerName `
    -auth NavUserPassword `
    -Credential $credential `
    -updateHosts `
    -memoryLimit 15G `
    -isolation process `
    -additionalParameters $AdditionalParameters `
    -artifactUrl $ArtifactURL `
    -dns '8.8.8.8' `
    -imageName $ImageName `
    -includeAL

Full output of scripts

PS C:\WINDOWS\system32> C:\Projects\docker\SimpleDemoContainer-Artifacts.ps1
Removing Desktop shortcuts
Removing C:\ProgramData\BcContainerHelper\Extensions\demo21x
BcContainerHelper is version 3.0.12
BcContainerHelper is running as administrator
Hyper-V is Enabled
UsePsSession is True
Host is Microsoft Windows 11 Pro - 21H2
Docker Client Version is 20.10.16
Docker Server Version is 20.10.16
Removing Desktop shortcuts
Fetching all docker images
Fetching all docker volumes
ArtifactUrl and ImageName specified
WARNING: Unable to find matching generic image for your host OS. Using mcr.microsoft.com/businesscentral:10.0.20348.887
Image local:sandbox-21.0.45833.0-nl-mt already exists
Using image local:sandbox-21.0.45833.0-nl-mt
Creating Container demo21x
Style: sandbox
Multitenant: Yes
Version: 21.0.45833.0
Platform: 21.0.45803.0
Generic Tag: 1.0.2.13
Container OS Version: 10.0.20348.887 (ltsc2022)
Host OS Version: 10.0.22000.856 (21H2)
Using process isolation
Using locale nl-NL
Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable)
Using license file https://cegekadsatemplates.blob.core.windows.net/business-central-license/dev.flf
Downloading C:\ProgramData\BcContainerHelper\Extensions\demo21x\my\license.flf
Additional Parameters:
-v C:\Projects\docker:c:\temp
--env locale=nl-NL
--env ACCEPT_OUTDATED=y
Files in C:\ProgramData\BcContainerHelper\Extensions\demo21x\my:
- AdditionalOutput.ps1
- license.flf
- MainLoop.ps1
- SetupVariables.ps1
- updatehosts.ps1
Creating container demo21x from image local:sandbox-21.0.45833.0-nl-mt
f7c31ceae8094ffff6edd30efb80f2b4c03df496b0a04c1f388714a569054267
Waiting for container demo21x to be ready
Initializing...
Setting host.docker.internal to 192.168.2.39 in container hosts file (copy from host hosts file)
Setting gateway.docker.internal to 192.168.2.39 in container hosts file (copy from host hosts file)
Setting host.containerhelper.internal to 172.24.176.1 in container hosts file
Starting Container
Hostname is demo21x
PublicDnsName is demo21x
Using NavUserPassword Authentication
Starting Local SQL Server
Starting Internet Information Server
Creating Self Signed Certificate
Self Signed Certificate Thumbprint B8337DB241865EFA052207F95C03AD89678A37D6
DNS identity demo21x
Modifying Service Tier Config File with Instance Specific Settings
Starting Service Tier
Registering event sources
Creating DotNetCore Web Server Instance
Using application pool name: BC
Using default container name: NavWebApplicationContainer
Copy files to WWW root C:\inetpub\wwwroot\BC
Create the application pool BC
Create website: NavWebApplicationContainer without SSL
Update configuration: navsettings.json
Done Configuring Web Client
Enabling Financials User Experience
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 devadmin as SQL User and add to sysadmin
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.24.185.90
Container Hostname  : demo21x
Container Dns Name  : demo21x
Web Client          : http://demo21x/BC/?tenant=default
Dev. Server         : http://demo21x
Dev. ServerInstance : BC
Dev. Server Tenant  : default
Setting demo21x to 172.24.185.90 in host hosts file
Setting demo21x-default to 172.24.185.90 in host hosts file
Setting demo21x-default to 172.24.185.90 in container hosts file

Files:
http://demo21x:8080/ALLanguage.vsix

Container Total Physical Memory is 63.8Gb
Container Free Physical Memory is 38.9Gb

Initialization took 82 seconds
Ready for connections!
Reading CustomSettings.config from demo21x
Creating Desktop Shortcuts for demo21x
Creating .net Assembly Reference Folder for VS Code
Copying DLLs from C:\Windows\assembly to assemblyProbingPath
Copying DLLs from C:\Windows\Microsoft.NET\assembly to assemblyProbingPath
Copying DLLs from C:\Program Files\Microsoft Dynamics NAV\210\Service to assemblyProbingPath
Copying DLLs from C:\Test Assemblies\Mock Assemblies to assemblyProbingPath
Copying DLLs from C:\Program Files (x86)\Open XML SDK to assemblyProbingPath
Container demo21x successfully created

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

After creating the container try to compile the BaseApp using VSCode. Following errors are reported:
c:\s-ERP AL\extensions\BaseApp\src\original\QuestionnaireManagement.Codeunit.al(375,40): error AL0133: Argument 1: cannot convert from 'DotNet "DocumentFormat.OpenXml.Spreadsheet.MapInfo"' to 'DotNet "DocumentFormat.OpenXml.Spreadsheet.MapInfo"'
c:\s-ERP AL\extensions\BaseApp\src\original\QuestionnaireManagement.Codeunit.al(380,45): error AL0133: Argument 1: cannot convert from 'DotNet "DocumentFormat.OpenXml.Spreadsheet.Workbook"' to 'DotNet "DocumentFormat.OpenXml.Spreadsheet.Workbook"'
Etc,...

Solution
After removing the duplicate assemblies and only keeping version in folder ..netPackages\Service\DocumentFormat.OpenXml.dll, the issue was solved.

@freddydk
Copy link
Contributor

freddydk commented Sep 19, 2022

Thanks Ron

The issue here is that Prerequisite Components.json includes the OpenXML 2.5 package in version 21.
I have created a temp. fix for this in ContainerHelper to fix the issue immediately - and will contact the infrastructure team responsible for creating the artifacts.

Second problem is that the DLL is actually installed in the generic image.
Again - I will patch in ContainerHelper - and we will likely have a true fix (and a new image, which doesn't include dotnet framework in 6 months from now for version 22)

freddydk pushed a commit that referenced this issue Sep 19, 2022
freddydk pushed a commit that referenced this issue Sep 19, 2022
@freddydk freddydk mentioned this issue Sep 19, 2022
@freddydk
Copy link
Contributor

Shipped in 4.0.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants