Can't get Code Source Files to work

I’m trying Code Source File for the first time. But I can’t get anything to work. Am I misunderstanding something?
I get an error message: MySecondProperty is not a member of MyClass

@oyvind.restad

That looks wierd…try to delete the assign and readd to check…

Also just to confirm…type MyInstance. And press ctrl+space then intellisense should work and show you the available properties as well

Note: just observed it might be showing light that when selected but once you move it is not showing the error

Cheers

I have tried to delete the assigned, but no luck. The intellisense shows all the properties and the method.

When analyzing the file, I get the same error.
I have tried to create new projects, but each time I get these kind of problems.

@oyvind.restad

Thats odd…I just tried the same setup and i see no error…can you try changingn the system pckage versions and check…

fyi:I am on the latest packages and studio version

check this file if this works for you

Datatableappstry.zip (2.7 KB)

Cheers

1 Like

Thanks for spending time :slight_smile:
I tried your project, and it worked. But the minute I added My3prop things fell apart. It’s almost like Studio compiles the cs file the first time, but not when I do changes. I don’t need to manually push a button to recompile the file? If you wanna try, this is the project with the added My3prop that fails.

But it helps to know that this should work. I have tried to reinstall UiPath studio, but that did not fix anything. But I also have Visual Studio installed. I might try to uninstall and try again.

The fact that your code worked, and then again not, tells me that it is not the packages. I have Studio version 2023.12.0

Datatableappstry.zip (2.8 KB)

@oyvind.restad

Okay so now lets take a step forward…

Try to delete the .nuget folder in C:\users\<username>\.nuget

And then reopen the project or create a new project and check…

For me I dont see an issue and I am on same version…

It does say when the assign is highlighted or when the right aide of assign is clicked but does compile and also the error goes off when i click else where

Cheers

First let me say that I really appreciate your time. :timer_clock:

I reopened the project after deleting .nuget and things look good. I can debug the file, and it runs as it should.
Analyzing the project also shows no errors.

But when trying to publish the project I get the error pasted at the bottom.

Adding another property to the class makes all fall apart again as before.

Here you see a screenshot after i analyzed the project and you see that Intellisense know about My5prop

Hmm. I need to test if it was deleting the .nuget folder or restarting Studio that made the error message go away…

It seems like it was restarting UiPath Studio that removed the error message, and lets me debug the project. But I still can’t publish the project. And of course, if i change something in the c#-code, I have to restart Studio again. Publishing another project without c#-code works.

Error		System.IO.FileLoadException: Could not load file or assembly 'Datatableappstry.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. Operation is not supported. (0x80131515)
File name: 'Datatableappstry.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
 ---> System.NotSupportedException: Resolving to a collectible assembly is not supported.
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, StackCrawlMarkHandle stackMark, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack type, ObjectHandleOnStack keepalive)
   at System.Type.GetType(String typeName, Boolean throwOnError)
   at UiPath.Excel.Activities.Design.Rules.ExcelTrackingRule.<>c.<PopulateExcelContext>b__10_0(IVariableModel v)
   at System.Linq.Enumerable.WhereListIterator`1.MoveNext()
   at UiPath.Excel.Activities.Design.Rules.ExcelTrackingRule.PopulateExcelContext(IActivityModel activity, IDictionary`2 excelContext)
   at UiPath.Excel.Activities.Design.Rules.ExcelTrackingRule.Walk(IActivityModel activity, ICollection`1 messages, IDictionary`2 excelContext)
   at UiPath.Excel.Activities.Design.Rules.ExcelTrackingRule.InspectWorkflow(IWorkflowModel workflow)
   at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.ToList()
   at UiPath.Excel.Activities.Design.Rules.ExcelTrackingRule.Inspect(IProjectModel project, Metadata metadata)
   at UiPath.Studio.Analyzer.Execution.Jobs.MetadataJob`1.ExecuteInternal()
   at UiPath.Studio.Analyzer.Execution.Jobs.JobBase.Execute()


@oyvind.restad

Instead of preview can you tey downgrading the packages and check…specifically system packages…I can verify the same as well to publish or add more and check…

One quick question is there any onedrive activated on your system and are you project files in that fodler? If ao try moving them to some other folder

Cheers

Downgrading did not fix the problem.

I have no onedrive activated, or any other backup software.

Moving the files does not work.

@oyvind.restad

I can confirm there is an issue in publishing…

@loginerror - Can you please look into this

cheers

I used coded source files reguarly now, and whilst there are still some awkward bits in Studio 23.4 when it was still in preview I thought that 23.10 ironed out alot of the bugs.

What you show is a valid class, usually the behaviour is that when you save a coded workflow you get an entry in the Output pane stating ‘coded workflows now available’ or similar. Are you getting that?
That part will re-compile the code and make the updated properties available.

It says “Updated coded types available to workflows based on the latest Changes”.

Can you try it in a multi assign instead of an assign?

I know thats a weird thing to suggest but here is my theory.
Basically the built in workflow analyzer is broken when it comes to coded workflows / source files and frequently whinges and moans about errors that aren’t there.
Early into coded workflows I had to publish via command line to skip the built in analyzer as it kept saying my code had compile errors when it didn’t.

I wonder if the red alert you see is suppressed in the multi assign (which I typically use) as often in the advanced editor it claims an error that is not there.

The worst worst case workaround is to make your class in a library, then publish that to the orch and reference the library in your project. You shouldnt need to though.

Hi @oyvind.restad. Unfortunately we introduce a bug in 23.12.0 regarding design time build. A fix will be available in 24.2 which is few days away from release. Alternatively you may consider downgrading to 23.10.x which should work as expected.

1 Like

The multiassign did not help. But as mentioned before, it helps restarting Studio after each change in the coded file.

Yesterday I had problems publishing the file, but not today???
So there is something fishy going on.

Just tell me if there is something else you want me to do.

Looks like you have your answer above.
They made a bug, thats part of using the Community Version. You are a beta tester :stuck_out_tongue:

I’ll wait for 24.2 and wait marking this as a solution until I know the answer :slightly_smiling_face:

Please let us know if this issue was fixed for you on Studio 2024.2 :slight_smile: (it was released yesterday).

Thank you. After a quick test it seems like everything is ok.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.