When using C# certain things no longer compile. I do not know the extent of the issue but its clearly a bug and I can recreate it using a JObject.
If I make a Library with an Activity containing an InArgument of type JObject then a C# project using that activity no longer compiles.
I have attached a zip containing various projects (and nugets from the libraries) demonstrating this.
There is a library made in C# and in VB.net to eliminate the language of the library being an issue, each activity just contains a log message and an input argument of type JObject.
In a VB.net project I can add both of these activities and the code compiles and can run, the project ‘VB Project’ demonstrates that.
In a C# project the code refuses to compile on either library activity claiming it cannot convert a JObject to a JObject.
Something is clearly going wrong during the compilation.
The same projects work correctly on version 22.10 using the libraries built in 23.4.1 showing its absolutely a bug that has been introduced.
This seems like a rather serious bug to me and one that blocks me from using 23.4, I already had to roll back some updates because of it.
I will check this, but a few key things to consider:
The nuget package is using the same version of Newtonsoft as your UiPath process.
What if you make your InArgument a Dictionary<string, object> and use it to construct your JObject? As long as you don’t have an OutArgument of type JObject.
It’d also help if you could take a screenshot of the error if that’s possible?
Not claiming to be pro, but I will definitely look into it
The two demo processes I attach have all their references removed except the libraries containing the activities so they absolutely have the exact same references, this is not a reference issue.
Irrelevant. I am not looking for a workaround, this is a bug and I should be able to have a JObject argument on an activity, as I have in the past.
I ran it and it didn’t work. But then I removed unused references and re-ran the project, and it worked without any issues.
I also added a reference to Json.NET (in both the library and the process), I don’t know how you were able to import the namespace without referencing the library.
This is very interesting, can you please confirm you are running Studio 23.4.1 please?
You did not include the nuget files so I’d need to recompile all the libraries again, could you perhaps include the versions 1.0.3 that you made and I’ll see if they work? I dont think the libraries are the cause but worth double checking.
Its inherited from other nugets in there, see. Its absolutely everywhere.
Which obviously doesn’t make much sense as why would you convert a JObject to a JObject, however now I think the error is that there are JObjects of differing versions.
In my library the version of Newtonsoft that is resolved in 13.0.1 because of UiPath.Platform 23.4.1
If I force the version to be higher by explicitly adding 13.0.3 the library then it starts working.
UiPath has had issues with Newtonsoft versions in the past but I thought they’d fixed them all.
I still think there is a bug in Studio 23.4.1 because I dont know why I can compile the same project on 22.10.7 but at least now I have a workaround I can implement. Cheers for rubber ducking me towards a better understanding @rizistt !
I’ve also reproduced the issue in my setup using the attached projects.
However, removing the unused imports did not fix the issue, in my case. What actually worked was to remove both the activities and then add them back to the project. By doing so, compilation was successful.
I’ve tried replicating the bug using newly created libraries and projects, but I couldn’t. They all worked as expected in my setup, which indicates this issue also has something to do with the upgrade.
Your video was helpful to show your steps to reproduce, thanks, I might need to get some tips from you as to how to attach a video here for future reference when I want to report somethin.
I fear you missed one last step however when you were trying to solve the issue. The compilation bug doesn’t occur if you do not try to pass a variable/object to the workflows. When you remade the activities you didnt restore the variable and as such the compilation goes away. I’d wager that if you were to add that variable back into the property then it would fail to compile again.
Indeed, I missed the fact that a variable was associated to the input field of the custom activities. When doing so, the workaround I mentioned in my previous comment is not applicable. So there is no actual workaround for this scenario so far.
I’ve updated the bug to include this information as well.
Adding a video can be done by recording the steps using a video recorder application and then dragging the resulted video file inside the text box. I’m not sure about the supported extensions, but I’ve used an mp4 file.
Worth noting, this workaround is not reliable. When adding other libraries things started to break again meaning 23.4 is still unusable. The update to 23.4.1 from 23.4.0 did not help.