I have been making a large update to a large 2021 project.
I updated all of the package versions and did a big overhaul which I was prepared for.
However, the method for adding new pairs into a dictionary which they used seems to not be working anymore. They used an assign activity in the same way as the example below:
myDictionary(“nonExistingKey”) = “myValue”
What was changed that this does not work anymore?
Could it be related to the studio or activities version I am using?
I am struggling to understand how the code ever would have worked with these exception causing activities littered throughout the code but it is working in production right now.
I cannot find anyone online mentioning that this is valid VB, although I know its valid C# (substituting square brackets).
For the purpose of getting this closed out this is actually valid in UiPath - assigning a value to a key that does not yet exist using an Assign activity.
However, there are other threads that would lead you to believe that this is invalid which it is not - it is only invalid when writing visual basic.
The issue I was experiencing was caused by an incorrect line of Linq which then threw an exception. Instead of getting the original Linq exception, the Assign activity seems to have some kind of try catch surrounding it under the hood that if an exception occurs, it simply catches it and throws an exception with a generic message explaining it ‘could not assign’.