Wrong Result return RunOnClient = No

yukonyukon Member Posts: 361
According to MSDN we can define the dot net interpo is running at Client or Server side. But some of the case it working on Server Side but return result is taking from client information. I don't know what is the reason of this. Does anybody face this issue?

Make Simple & Easy


  • RockWithNAVRockWithNAV Member Posts: 1,139
    I used this property multiple ti,es but never faced this. Can you explain it more with the codes?
  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    It might be due to lack of user process isolation.

    You don't know what is inside the particular .NET t interop - it might be using some shared memory, it might have static members. If it is the case you may two users having their own instances of .NET vars, but since they both run on the same NST process the internall .NET code might be manipulating internally the same aera of memory, so the data is leaking between users' processes.

    Not sure, just guessing.

    Long time ago when the RTC came to life and people were using in their code single instance codeunits they moaned that if they use the same code from a web service call the data inside single instance codeunit is not preserved between calls (which was just a lack of understanding that each web service call is a separate session). Someone came up with a trick exploiting static class members to build a .NET dll enabling to preserve the status/data between web calls - effectively sharing the data between sessions.

    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • yukonyukon Member Posts: 361
    @Slawek_Guzek and @RockWithNAV

    Thanks for your reply and interesting on my question.

    Actually, i'm using single user to testing this case. Below is my test case

    OBJECT Codeunit 50000 DNetTest
    Time=[ 8:32:09 PM];
    Version List=;
    dnetSysRunOnClient@1000000000 : DotNet "'mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Security.Principal.WindowsIdentity" RUNONCLIENT;
    dnetSysRunOnServer@1000000001 : DotNet "'mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Security.Principal.WindowsIdentity";
    dnetCultureInfoRunOnClient@1000000002 : DotNet "'mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Globalization.CultureInfo" RUNONCLIENT;
    dnetCultureInfoRunOnServer@1000000003 : DotNet "'mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Globalization.CultureInfo";
    MESSAGE('Client User %1\Server User %2',

    dnetCultureInfoRunOnClient := dnetCultureInfoRunOnClient.CurrentCulture;
    dnetCultureInfoRunOnServer := dnetCultureInfoRunOnServer.CurrentCulture;

    MESSAGE('Client Culture %1\Server Culture %2',



    You will get right result for Login user name but Culture result is wrong. Why wrong? Culture name is always same, even you set different region setting on server and client. By right should be different name if we set different region setting on Server and Client. "dnetCultureInfoRunOnServer" is running on server but name is taken from "Client Region Name".

    In order to test you need to set different Region Setting on Server and Client.

    I was posted on https://community.dynamics.com/nav/f/34/t/276917. One of active member reply that can be Threading. I not sure how Nav server handle the threading in between server and client.

    Make Simple & Easy
Sign In or Register to comment.