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

Encoding issue related to compilation in container (NAV 2018) #3749

Open
RomashkovOleg opened this issue Nov 5, 2024 · 2 comments
Open

Encoding issue related to compilation in container (NAV 2018) #3749

RomashkovOleg opened this issue Nov 5, 2024 · 2 comments
Assignees

Comments

@RomashkovOleg
Copy link

Hi,

I'm making CI/CD for some legacy NAV 2018 project which uses a lot of local language code/text values and met strange issue related to compilation in container.

Repros

  1. Make a container
$ContainerName = "cronus-2018"
$artifactUrl = Get-BCArtifactUrl -type OnPrem -version 11
$password = '123'
$securePassword = ConvertTo-SecureString -String $password -AsPlainText -Force
$credential = New-Object pscredential 'admin', $securePassword

$parameters = @{
    "accept_eula"               = $true
    "ContainerName"             = $ContainerName
    "artifactUrl"               = $artifactUrl
    "auth"                      = "NavUserPassword"
    "Credential"                = $credential
    "updateHosts"               = $true
    "doNotCheckHealth"          = $true
    "EnableTaskScheduler"       = $false
    "Isolation"                 = "hyperv"
    "MemoryLimit"               = "8G"
    }
New-NavContainer @parameters `
    -includeCSide `
    -doNotExportObjectsToText
  1. Prepare simple test codeunit, which uses local language text. Save it in text format:
    EncodingIssueDemo.txt
OBJECT Codeunit 50000 Encoding Issue Demo
{
  OBJECT-PROPERTIES
  {
    Date=;
    Time=;
    Version List=Test;
  }
  PROPERTIES
  {
    Subtype=Test;
    OnRun=BEGIN
          END;

  }
  CODE
  {

    [Test]
    PROCEDURE LocalLanguageErrorSample@1170000002();
    VAR
      GLSetup@1170000000 : Record 98;
    BEGIN
      // Some local language comment:
      // пример комментария

      // Sample of local language error
      ERROR('Ошибка');
    END;

    BEGIN
    END.
  }
}

How it looks in development environment:

How initial test result looks in test tool interface:

So far so good.

  1. Run script to import and compile this object in container:
Import-ObjectsToNavContainer -containerName cronus-2018 -objectsFile "C:\Temp\EncodingIssueDemo.txt"
Compile-ObjectsInNavContainer -containerName cronus-2018 -filter "Type=Codeunit;ID=50000"
  1. Run test tool and execute test:

Same step with debugger:

Result: local language text values spoiled.

  1. Now go to DevEnv and recompile object manually. After that everything looks as expected (both C/AL code and test result)

In the repository I store objects in UTF8 encoding, so I tried to repeat steps 3-4 with incorrectly encoded file.
EncodingIssueDemo_UTF8.txt

To my surprise I got expected test result!

But code in DevEnv is spoiled:

And after manual compilation test result is spoiled too:

Additional context
I tried container with RU system locale, which was made with process isolation. Also I used parameters -locale and - setServiceTierUserLocale for New-NavContainer and -country ru for atifacts. Same result again.

I suppose, that problem is related to compilation in container. I tried to do the same with "finsql.exe command=compileobjects…" but got same result.

I understand that this is obsoleted NAV version and it is not supported any more. But maybe you see the step I missed or you know some trick which could help resolve this?

Thanks!

@freddydk
Copy link
Contributor

freddydk commented Nov 5, 2024

I won't have time to look at stuff like this for any foreseeable future.
if anybody else have seen this before and have a fix or a workaround, please come forward.

Else, you are more than welcome to troubleshoot and create a PR on BcContainerHelper with a fix if you manage to find it.

@RomashkovOleg
Copy link
Author

I won't have time to look at stuff like this for any foreseeable future. if anybody else have seen this before and have a fix or a workaround, please come forward.

Else, you are more than welcome to troubleshoot and create a PR on BcContainerHelper with a fix if you manage to find it.

Got it. Thanks!

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