Dll added via package manager fails to load to toolbox

OpenRPA version: 1.4.57.1
OpenFlow version: not relevant
Using app.openiap.io or self hosted openflow: not relevant
Error message:

16:57:10.1711|ERROR|System.IO.FileNotFoundException: Could not load file or assembly 'TestActivityLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'TestActivityLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.Load(String assemblyString)
   at System.Activities.Presentation.Toolbox.ToolboxItemWrapper.ResolveToolboxItem()
   at System.Activities.Presentation.Toolbox.ToolboxControl.OnToolPropertyChanged(Object sender, PropertyChangedEventArgs e)
   at System.Activities.Presentation.Toolbox.ToolboxControl.OnToolsCollectionChange(Object sender, NotifyCollectionChangedEventArgs args)
   at System.Activities.Presentation.Toolbox.ToolboxControl.OnCategoryCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at OpenRPA.Views.WFToolbox.InitializeActivitiesToolbox()

Screenshot or video:
Attach a simple workflow from OpenRPA or NodeRED that reproduces the error/issue:

Repro:

  1. Start OpenRPA

  2. Open Package Manager

  3. Add a nupkg containing any activity (like this one )

  4. Observe error message

  5. Observe that in the activity toolbox a category for the activity is added, but contains no activities
    image

  6. Create any new workflow

  7. Add a variable, browse for types

  8. Observe that the types from the added nupkg are available

It appears that only the toolbox loading fails, but the assembly is normally loaded into the appdomain (confirmed also via VS debug).

In 1.4.54 release the same package loads without error pop-up nor error log, and also doesn’t show the activity in most environments aside of 1 (inside the VDI for some reason…).

Can you see where it’s loading doing loading ?there is no reflection loading inside InitializeActivitiesToolbox so my best guess is you have a constructor that is referencing an dll that cannot be loaded or found (?)
what references do you have in your project file ?
to me this looks like a missing dll (referenced from your dll )

At first I thought the same, then checked with the gist I linked.

For convenience, this is the whole solution:


image

Nupkg was ggenerated with a simple nuget pack [project], but putting the .dll directly into extensions produces the same effect.
If the dll is put into the installation folder though (not viable for anything but a quick test), it works just fine, so there’s something weird going on here that I can’t really pinpoint.

I’m not really seeing any mismatched or missing dependencies either (executed from the wfToolbox.xaml.cs after appAssemblies are fetched from current AppDomain)

Interesting … then i have a hint
OpenRPA does not use .nets own assembly resolver.
Maybe there is something flawed in my code for that
Maybe add more debug information and/or breakpoints with expressions here

That was it :slight_smile:

I’ve went through the rabbit hole of checking the inner WF call stack, and indeed it does try to Assembly.Load deeper in the ToolboxItemWrapper in System.Activities.Presentation, and can’t find it. It appears that the Assembly.LoadFrom does make it cache how to find it (at least if I understand the runtime assembly finding docs), but it was skipping due to location mismatch.

PR’d a fix to your branch.

1 Like

Thanks ! …

Should i make nolitedb the new official release or wait for more testing ?

Haven’t tested too much yet due to the .dll issue (I want to run it on a “real” project not just some random invokes that barely do anything).
There’s still some todo’s there to check (also from performance perspective - the IO load could potentially be pretty harsh with local files), but I’ll get to that now.

1 Like

perfect, then i can work a little on this

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