microsoft / navcontainerhelper

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

Negative sign doesn't work with Swedish as regional setting #2154

Closed jwikman closed 2 years ago

jwikman commented 2 years ago

Describe the issue When using "Swedish (Sweden)" as region in your personal settings, the minus signs in all decimal fields looks strange (it is longer than the regular one) and we cannot enter anyting with a minus sign. Error received: Your entry of '-1110' is not an acceptable value for 'Unit Price Excl. VAT'. '-1110' is not a part of a valid decimal expression. When doing the same with "English (USA)" as region, the minus sign looks as expected and all works fine.

(The same issue seems to exist in Finland and Norway, maybe others as well)

We've tried a lot of different versions, with platform both older and newer than the one we're running Online (Platform 19.0.29884.31362), with the same error. OnPrem installations seems to work as well.

So this make us believe that this is a Docker container issue.

Scripts used to create container and cause the issue We're creating container with artifact url: https://bcartifacts.azureedge.net/sandbox/19.0.29894.31532/se

Full output of scripts

BcContainerHelper is version 2.0.16
BcContainerHelper is running as administrator
Host is Microsoft Windows 10 Enterprise - 20H2
Docker Client Version is 20.10.8
Docker Server Version is 20.10.8
Removing container current
Removing current from container hosts file
Removing current-* from container hosts file
Certificate with thumbprint A889F288E19D6D3BF3D3EDDF2DD41BDEB61C999E removed successfully
Removing C:\ProgramData\BcContainerHelper\Extensions\current
Fetching all docker images
Fetching all docker volumes
Pulling image mcr.microsoft.com/businesscentral:10.0.19042.1288
10.0.19042.1288: Pulling from businesscentral
Digest: sha256:74d11fc91d0eaea99af65edab29a801dbc275c6ab99c16f9e8b84d60fbe46796
Status: Image is up to date for mcr.microsoft.com/businesscentral:10.0.19042.1288
mcr.microsoft.com/businesscentral:10.0.19042.1288
Using image mcr.microsoft.com/businesscentral:10.0.19042.1288
Disabling Health Check (always report healthy)
Creating Container current
Style: sandbox
Multitenant: No
Version: 19.0.29894.31532
Platform: 19.0.29884.31443
Generic Tag: 1.0.1.8
Container OS Version: 10.0.19042.1288 (20H2)
Host OS Version: 10.0.19042.1288 (20H2)
Using process isolation
Using locale sv-SE
Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable)
Downloading C:\ProgramData\BcContainerHelper\Extensions\current\Microsoft.VisualStudio.Services.VSIXPackage.vsix
Using license file D:\VSCode\Git\NAB\NAB DevOps Tools\License\nab.flf
Additional Parameters:
--volume "D:\VSCode\Git\NAB\NAB DevOps Tools:C:\Source"
--env appiduri=api://4605f65c-a5f5-401b-b2d8-e15446d55958
--env customNavSettings=EnableTaskScheduler=True
Files in C:\ProgramData\BcContainerHelper\Extensions\current\my:
- AdditionalOutput.ps1
- license.flf
- MainLoop.ps1
- SetupVariables.ps1
- SetupWebClient.ps1
- updatehosts.ps1
Creating container current from image mcr.microsoft.com/businesscentral:10.0.19042.1288
8b302bd1b4386d3df1aa192023bcb3e34bef5dccb250092eb9e0f416f84920a7
Waiting for container current to be ready
Using artifactUrl https://bcartifacts.azureedge.net/sandbox/19.0.29894.31532/se
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\19.0.29894.31532\platform\ServiceTier\Program Files
c:\dl\sandbox\19.0.29894.31532\platform\ServiceTier\System64Folder
Copying PowerShell Scripts
c:\dl\sandbox\19.0.29894.31532\platform\WindowsPowerShellScripts\Cloud\NAVAdministration
c:\dl\sandbox\19.0.29894.31532\platform\WindowsPowerShellScripts\WebSearch
Copying dependencies
Copying ReportBuilder
Importing PowerShell Modules
Determining Database Collation from c:\dl\sandbox\19.0.29894.31532\se\BusinessCentral-SE.bak
Changing Database Server Collation to Finnish_Swedish_100_CS_AS
Restoring CRONUS Demo Database
Setting CompatibilityLevel for CRONUS on localhost\SQLEXPRESS
Modifying Business Central Service Tier Config File for Docker
Creating Business Central Service Tier
Installing SIP crypto provider: 'C:\Windows\System32\NavSip.dll'
Copying Web Client Files
c:\dl\sandbox\19.0.29894.31532\platform\WebClient\Microsoft Dynamics NAV
Copying Client Files
c:\dl\sandbox\19.0.29894.31532\platform\LegacyDlls\program files\Microsoft Dynamics NAV
c:\dl\sandbox\19.0.29894.31532\platform\LegacyDlls\program files\Microsoft Dynamics NAV
c:\dl\sandbox\19.0.29894.31532\platform\LegacyDlls\systemFolder
Copying ModernDev Files
c:\dl\sandbox\19.0.29894.31532\platform
c:\dl\sandbox\19.0.29894.31532\platform\ModernDev\program files\Microsoft Dynamics NAV
Copying additional files
Copying ConfigurationPackages
C:\dl\sandbox\19.0.29894.31532\se\ConfigurationPackages
Copying Test Assemblies
C:\dl\sandbox\19.0.29894.31532\platform\Test Assemblies
Copying Extensions
C:\dl\sandbox\19.0.29894.31532\se\Extensions
Copying Applications
C:\dl\sandbox\19.0.29894.31532\platform\Applications
Copying Applications.SE
C:\dl\sandbox\19.0.29894.31532\se\Applications.SE
Starting Business Central Service Tier
Importing license file
Stopping Business Central Service Tier
Installation took 60 seconds
Installation complete
Initializing...
Setting host.docker.internal to 10.69.0.117 in container hosts file (copy from host hosts file)
Setting gateway.docker.internal to 10.69.0.117 in container hosts file (copy from host hosts file)
Setting kubernetes.docker.internal to 127.0.0.1 in container hosts file (copy from host hosts file)
Setting host.containerhelper.internal to 172.23.80.1 in container hosts file
Starting Container
Hostname is current
PublicDnsName is current
Using NavUserPassword Authentication
Creating Self Signed Certificate
Self Signed Certificate Thumbprint DFF92C9537025BF3DE74898F2F518B9DBB603F6F
Modifying Service Tier Config File with Instance Specific Settings
Modifying Service Tier Config File with settings from environment variable
Setting EnableTaskScheduler to True
Starting Service Tier
Registering event sources
Creating DotNetCore Web Server Instance
Enabling Financials User Experience
Using license file 'c:\run\my\license.flf'
Import License
Creating http download site
Setting SA Password and enabling SA
Creating admin as SQL User and add to sysadmin
Creating SUPER user
Container IP Address: 172.23.83.93
Container Hostname  : current
Container Dns Name  : current
Web Client          : http://current/BC/
Dev. Server         : http://current
Dev. ServerInstance : BC
Setting current to 172.23.83.93 in host hosts file

Files:
http://current:8080/Microsoft.VisualStudio.Services.VSIXPackage.vsix

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

Initialization took 22 seconds
Ready for connections!

Screenshots image In above image you can see the strange minus sign on the first line and the regular minus in the second line, where I try to input -500

Additional context

jwikman commented 2 years ago

Just tested to create a BC18 container, with BCArtifactUrl https://bcartifacts.azureedge.net/sandbox/18.5.29545.31525/se - this works as expected. And this container uses the same base image, mcr.microsoft.com/businesscentral:10.0.19042.1288, as the BC19 version with issues.

freddydk commented 2 years ago

Sorry for the delay - did you try to press ctrl+Z (undo) when you see the editor turn the minus into the looong minus? In other areas, I have seen that work. I will investigate the issue.

jwikman commented 2 years ago

did you try to press ctrl+Z (undo) when you see the editor turn the minus into the looong minus?

It's not like that. The editor is not changing the minus into a loooong minus. Negative values are shown with a looong minus. I cannot enter negative values either with regular minus or with looong minus.

I even had Duilio T. to repro this on his Italian machine, so it should be an easy repro for you as well. Hopefully it's as easy as you figure out why this happens. 😉

freddydk commented 2 years ago

so, if you add -locale 'en-US' to your new-bccontainer, it works? or is it when you run the US artifacts?

freddydk commented 2 years ago

Is there any change if you run with hyperv isolation? Have you been able to repro the problem on other windows versions (than 19042)?

(I will try on Windows 11 now)

freddydk commented 2 years ago

works fine here image Container creation script:

$licenseFile = $LicenseFileSecret.SecretValue | Get-PlainText
$auth = "UserPassword"
$credential = New-Object pscredential -ArgumentList 'admin', $PasswordSecret.SecretValue
$artifactUrl = Get-BCArtifactUrl -country se
New-BcContainer `
    -accept_eula `
    -artifact $artifactUrl `
    -auth $auth `
    -Credential $credential `
    -licenseFile $licenseFile `
    -updatehosts
jwikman commented 2 years ago

so, if you add -locale 'en-US' to your new-bccontainer, it works? or is it when you run the US artifacts?

Sorry for not being perfectly clear. It's when changing the region in "My settings" inside BC this issue occurs.

If I select "Swedish (Sweden)" I get this issue (same issue with Norway, Finland and probably more) image

When using "English (United States)" it works as usual image

I just created a container with same issues.

$artifactUrl = Get-BCArtifactUrl -country se
New-BcContainer `
    -accept_eula `
    -artifact $artifactUrl `
    -auth $auth `
    -Credential $credential `
    -licenseFile $licenseFile `
    -updatehosts `
    -containerName 'minus' `
    -useGenericImage "mcr.microsoft.com/businesscentral:10.0.19042.1288"

All machines we've tested on was 19042.1288... Please try to change region in My Settings to see if you can get a repro there.

jwikman commented 2 years ago

Now I've upgraded my machine to W11 and created a new container - same issue still exists.

Windows version 22000.282 artifactUrl https://bcartifacts.azureedge.net/sandbox/19.0.29894.32037/se genericImage: mcr.microsoft.com/businesscentral:10.0.20348.288

freddydk commented 2 years ago

Did you try to install BC (on premises) using the setup.exe - and see if the problem reproes there?

jwikman commented 2 years ago

On premises works fine. Installed on Windows 2016 server, (Version 1607, 14393.4704). Platform 19.0.29884.30666 + App 19.0.29894.30693

Did you manage to repro on Docker on W11?

freddydk commented 2 years ago

Yes - also on Windows Server 2019 and Windows Server 2022. I have e-mailed the WebClient team and asked for their view on this - I am totally puzzled.

jwikman commented 2 years ago

Ok, good. But so strange... Then let's see what they say.

freddydk commented 2 years ago

I have a workaround for the issue, which is in the generic image. Until I have created new generic images, you can start the conainer with

-myscripts @("https://raw.githubusercontent.com/microsoft/nav-docker/master/generic/Run/150-new/SetupWebClient.ps1")

Then it should work again.

freddydk commented 2 years ago

Some more info can be found here: This related to change in .NET 5, where they use the new standard called CLDR. Here it is a github thread about this issue: https://github.com/dotnet/runtime/issues/44678

jwikman commented 2 years ago

Thanks @freddydk I can confirm that the workaround works. A bit strange change, but it's according to the Unicode Standard so I hope that is well grounded :)

So Nls are being used for BC Online already then?

freddydk commented 2 years ago

This is not really related to BcContainerHelper. With the next round of Windows updates (generic images) the fix will be included. Until then, you will have to include the url in myscripts.