Initialising Dictionary of type <String, Browser>

Hi there,
I’m getting a data type mismatch as my Dictionary isn’t initialising managing to initialise before adding items to it. I’ve attempted to initialise it at the start but UiPath doesn’t seem to recognise it.


The workflow is trying to:
Generate browser variables, and store each with an associated name/description. So for example I may have the following:-
<“Chrome Bla Bla”, BrowserChrome>
<“Firefox Bla Dee Bla”, BrowserFirefox>


Here is the syntax error:
Compiler error(s) encountered processing expression
“out_browserDictionary”.
Option Strict On disallows implicit conversions from
‘System.Collections.Generic.Dictionary(Of String, UiPath.Core.Browser)’ to
‘System.Collections.Generic.lDictionary(Of Object, Object)’.


Here is my setup:-
Studio 2020.2.0-beta.108 - 9/11/1953
Community License
EXE Installer
License Provider: Internal
Activation ID: UIP-e12938c6ec
Update Channel: Preview
Microsoft Windows 10 Enterprise 64-bit
.NET Framework Version 4.7.2 or later


BrowserVariableGenerator.xaml

project.json

Hi,

The following post will help you.

Regards,

Hi @Brendan_Neill,

Remove the existing Add to Dictionary activity and add it back again with the right type <String, UiPath.Core.Browser> that should resolve your error.

Secondly, the Count condition will throw an error when you compile. To avoid that, I recommend initializing the dictionary no matter what (it’s an out type argument so you have to initialize inside before sending out)

Happy Automating!

Regards,
PD

Hi, let us know if your issue is resolved!

Thanks for the great suggestions. I’ll not have time to look today but will report back tomorrow some time. Thanks again :slight_smile:

Hi there,
I can’t add screen grabs to posts so I’ll try explain as best I can.

I don’t get the window box appearing that allows you define the types when you Add To Dictionary, that is from this post…

…I just get the Add To Dictionary Window, with the three text fields: Dictionary; Key; Value. This screen seems to be the screen I need. I sound like there is a bug somewhere as if you click below the activity it shows for that user. Not for me though. Arghh!!

As you can tell from my original post, I’ve already tried using the Assign to initialise the Dictionary, as per this suggestion…

I’ll try the other suggestions and respond accordingly.

Hi PD2,
This was actually the first thing I tried, and yes I had spotted the mistake in using the Count condition. I’ve changed this to “out_browserDictionary is nothing” to identify an uninitialised Dictionary, then after that I’ll check for the Count. However, if I can initialise the Dictionary fine I may be able to ditch the “is nothing” test. ANy thoughts?
Cheers :slight_smile:

Any other ideas?

So I’m assuming UiPath is a little buggy still? I don’t feel like i’m trying to do anything too unusual. I’m new to UiPath, but I’m a developer, and this really feels quite basic functionality that is available to use, but doesn’t work. Or does it work for everyone else and not me?

:four_leaf_clover: :grimacing: :confused: :confused: :worried:

Going back to basics I thought I’d try a Dictionary<of String, String> to see if that works but I’ve not managed to get that working either?

Sadly I can’t attach things so here is a dropbox link:

I must be doing something wrong?

Re-create activity Add to dictionary, sometimes UiPath gets buggy with these things and needs to be re-done again.

It worked for me with ur last attached XAML

Hi Luis,
What version of Microsoft.Activities.Extensions are you using? I’m using 2.0.6.9.
Thanks :slight_smile:

I’ve tried a fresh install of Windows with UiPath Installed with the Latest Stable build:
2020/2/0-beta.108

I’m deeply sorry for the late answer!

Unfortunatelly, I cannot tell since the computer I was working for, I don’t have it anymore.
But I believe that its the most recent one, since I just tried it on the version that has cloud so it should be 2019-2020.

If you are still having issues (which I hope you don’t), I can retry again.

Regards!

Editing, since 2019-2020 version, the package should be one related to those version. I’m sorry I cannot tell you which one was.

Already made it again, Microsoft.Activities.Extension version package is 2.0.6.9 package with 2020 UiPath version