Wrong Result return RunOnClient = No

yukonyukon Posts: 355Member
Hi,
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?

Regards,
Make Simple & Easy

Answers

  • RockWithNAVRockWithNAV Posts: 657Member
    I used this property multiple ti,es but never faced this. Can you explain it more with the codes?
  • Slawek_GuzekSlawek_Guzek Posts: 1,444Member
    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
    Poszukuje programistow znajacych Microsoft Dynamics NAV
  • yukonyukon Posts: 355Member
    @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
    {
    OBJECT-PROPERTIES
    {
    Date=12/04/18;
    Time=[ 8:32:09 PM];
    Modified=Yes;
    Version List=;
    }
    PROPERTIES
    {
    OnRun=VAR
    [email protected] : DotNet "'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Security.Principal.WindowsIdentity" RUNONCLIENT;
    [email protected] : DotNet "'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Security.Principal.WindowsIdentity";
    [email protected] : DotNet "'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Globalization.CultureInfo" RUNONCLIENT;
    [email protected] : DotNet "'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Globalization.CultureInfo";
    BEGIN
    MESSAGE('Client User %1\Server User %2',
    dnetSysRunOnClient.GetCurrent.Name,dnetSysRunOnServer.GetCurrent.Name);

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

    MESSAGE('Client Culture %1\Server Culture %2',
    dnetCultureInfoRunOnClient.Name,dnetCultureInfoRunOnServer.Name);
    END;

    }
    CODE
    {

    BEGIN
    END.
    }
    }

    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.

    Regards,
    Make Simple & Easy
  • BlackTigerBlackTiger Posts: 1,096Member
    Impersonalization. User session thread uses client culture.
    "You can’t just ask customers what they want and then try to give that to them.
    By the time you get it built, they’ll want something new.” Steve Jobs
Sign In or Register to comment.