Launching Rhino.inside chnages host application culture

Hello,
I am developing the Rhino.inside.TopSolid.
I just found out that that launching rhinoCore chnages the host app culture.
Does launching RhinoInside change the host app culture ?
Is there is a way to control this ?
Here is the code I use to launch rhinoCore, which is basic and similar to most rhinoinside implementations.

if (rhinoCore == null)
                rhinoCore = new Rhino.Runtime.InProcess.RhinoCore(new string[] { "/NOSPLASH" }, WindowStyle.Normal);

Thanks a lot in advance !

Hi @ahmedwael.si,

Please try

rhinoCore = new Rhino.Runtime.InProcess.RhinoCore(new string[ ] { "/NOSPLASH", $"/language={CultureInfo.CurrentCulture.LCID}" }, WindowStyle.Normal);

Does it help?

1 Like

Hi @kike,
At first I thought this solved it, but it only solved the language culture, not the App culture.
Would there be other params to add in the string ?

Hey,

What do you mean by the App culture vs the Language Culture?

Could you please try this.

var currentCulture = CultureInfo.CurrentCulture;
try { core = new RhinoCore(new string[] { "/NOSPLASH" }, WindowStyle.Normal); }
finally { CultureInfo.CurrentCulture = currentCulture; }

Hi @kike,
Apparently in TopSolid there are 2 cultures : language culture and application culture (not sure of my terminology though).
As per your code, it corrects the error.
However, after more debugging, it seems that launching Grasshopper is what causes the culture change. This is indifferent to wether Grasshopper is launched by code or from Rhino’s interface.
Is there is a way to make Grasshopper not change the App culture ?
Thanks again for your help !

Alright, after some digging, I think I now understand it better:
Grasshopper always sets CurrentCulture to CultureInfo.InvariantCulture as explained by @DavidRutten here.
So, my question is :
Would there be a way to launch grasshopper without changing the CurrentCulture ?

Hello @DavidRutten,
I was wondering if there is a way to launch Grasshopper without setting CurrentCulture to InvariantCulture ?
My current workaround, thanks to @kike’s suggestion, is by resetting the CurrentCulture back after launching Grasshopper. It solves the problem, but I was wondering if there would be a way not to modify the CurrentCulture and reset it back.
Thank you in advance