Issue with creating global variables in UiPath Studio

Hi,

I am getting this error when I needed to .create a global variable in UiPath Studio.
“An error has occurred while generating the global variables assembly.”

Is there any solution I can follow for this issue.
Would appreciate if someone can help me out on this.
Thank you.

@shehani.perera,

Try this solution.

Thanks,
Ashok :slight_smile:

Thank you for your response.
I have tried this solution, but the error still consists even though I have imported them.
image
Would you have any solution for this error?

@shehani.perera,

Have you imported both the namespaces?

  1. GlobalVariablesNameSpace
  2. GlobalConstantNameSpace

Thanks,
Ashok :slight_smile:

Yes I have imported both namespaces you have mentioned.
image

Thank you,
Shez

@shehani.perera,

That’s strange, try adding another workflow and check if it’s same there also. Also try creating another project for testing.

Thanks,
Ashok :slight_smile:

@shehani.perera

is this happening only in this project or all projects?

try to open the xaml in notepad and check if the required namespaces are present

cheers

I checked, it only happens with this specific project I am currently working on. I can create global variables in other projects, but I’m wondering why this issue arises only in this project. :thinking:

Thanks,
Shez

Hi,

It’s only happens in this project.
Yes It’s included.
image

Thanks,
Shez

@shehani.perera

is this a project you migrated or so?

or is built on older versions?

if no much changes better use a different project and copy the files and check

cheers

Hi,

I was using UiPath Enterprise trial version before and recently transferred to the community version.
Thanks,
Shez

@shehani.perera

may be some studio changes must have caused this

try to reopen and upgrade packages and check

if not try renaming project.json and then restore dependencies as needed and check

cheers

1 Like

@shehani.perera,

If this is still not resolved, try checking the globalVariable.json file at below location.

Thanks,
Ashok :slight_smile:

Hi,

Thank you for your response. Although the issue didn’t resolve yet, I created a new project and copied the processes into it. Sometimes, it indicate an error infront of the imported GlobalVariablesNamesapce. Could you please tell me the path, where I can access this .json file? I can’t seem to locate it within my project.

Thanks,
Shez

@shehani.perera,

It’s in hidden folder named .project. You can make it visible by clicking on filter icon in Project panel and check Show hidden folders.

image

Inside that folder you will have globalVariables.json
image

Thanks,
Ashok :slight_smile:

Hi,

I checked in the shown globalVariables.json file, but the newly created global variable isn’t shown in the code. What would I be able to do?
Thanks

@shehani.perera,

You can create it from globalVariables.json file like this.
Add Global variable from json

Once added. Save the json. Close the project and studio. Reopen it again. The variable will be reflecting in Global variable list.

Thanks,
Ashok :slight_smile:

Hi, was this issue resolved and if so how? I’m getting an error with one project where getting same namespace error.

I tried deleting the namespace and the content of the globalVariables.json, saving the changes and closing the project. However, did not resolve anything.

In Data Manager panel, I don’t see ‘Global’ under ‘Variables’. When I try to add a new GV I get the error

24.10.8+Branch.support-v24.10.Sha.653ecc68c3ec77c9af349466b2c3925e0dfbe4a0.653ecc68c3ec77c9af349466b2c3925e0dfbe4a0

An error has occured while generating the global variables assembly.

Error: System.Exception: An error has occured while generating the global variables assembly.
at UiPath.Studio.Plugin.Workflow.GlobalVariables.GlobalVariablesProjectEndpoint.StoreVariables(IEnumerable`1 variables)
at UiPath.Studio.Plugin.Workflow.Business.DataManager.Services.GlobalVariablesDesignerService.StoreGlobalVariablesWithValidDefaultValuesOnly()
at UiPath.Studio.Plugin.Workflow.Business.DataManager.Services.GlobalVariablesDesignerService.ModelService_ModelChanged(Object sender, ModelChangedEventArgs e)
at System.Threading.Tasks.Task.<>c.b__128_0(Object state)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler), HResult -2146233088

I have another project created pretty much at the same time with the same age package dependencies, and that one has no issues and used Gobal Variables. That one also had the same error when I opened it, closing and re-opening the project solved it.

Any assistance to resolve, short of creating an empty new project and copying in all the workflows from the failing one, much appreciated.

Steve