Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Wrong Result return RunOnClient = No

Posted on by 714

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?

*This post is locked for comments

  • Yukon Profile Picture
    Yukon 714 on at
    RE: Wrong Result return RunOnClient = No

    Yes, i'm using Windows Client. I'm not sure Thread.CurrentCulture is starting on Client or Server. If Thread is start from Client PC it can't run on WebClient. Now no error on WebClient and same result as Window Client.  different result as windows. Name is not same as server or client.

  • Suggested answer
    Stefano Demiliani Profile Picture
    Stefano Demiliani 37,162 Most Valuable Professional on at
    RE: Wrong Result return RunOnClient = No

    Not sure but CurrentCulture is a property of the executing thread, which is returned by the static Thread.CurrentThread property. The value of the CultureInfo.CurrentCulture property corresponds to the value of the Thread.CurrentCulture property and the thread starts from client (you're using Windows Client isn't it?).

    RunOnClient works fine 100%, no issues on that.

  • Yukon Profile Picture
    Yukon 714 on at
    RE: Wrong Result return RunOnClient = No

    Hi Stefano Demiliani,

    Here is sample as per your request.

    OBJECT Codeunit 50000 DNetTest

    {
      OBJECT-PROPERTIES
      {
        Date=12/04/18;
        Time=[ 8:32:09 PM];
        Modified=Yes;
        Version List=;
      }
      PROPERTIES
      {
        OnRun=VAR
                dnetSysRunOnClient@1000000000 : DotNet "'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Security.Principal.WindowsIdentity" RUNONCLIENT;
                dnetSysRunOnServer@1000000001 : DotNet "'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Security.Principal.WindowsIdentity";
                dnetCultureInfoRunOnClient@1000000002 : DotNet "'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Globalization.CultureInfo" RUNONCLIENT;
                dnetCultureInfoRunOnServer@1000000003 : 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.

  • Suggested answer
    Stefano Demiliani Profile Picture
    Stefano Demiliani 37,162 Most Valuable Professional on at
    RE: Wrong Result return RunOnClient = No

    RunOnClient = NO means that the Automation/DotNet control will be executed at server side (from service tier), otherwise it will be executed at client side (machine where the NAV client runs).

    There are no problems on that. Can you post an example for your case?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans