Following quick start but can't get it to run - elsa-workflows

I am following the QuickStart to get a Server + Dashboard going. First I tried using .NET 6 and the .NET Core 3.1 but in both cases, when the code gets to
.UseEndpoints(....
in Startup.cs,
I get this set of exceptions
'Unable to load one or more of the requested types.
Could not load type 'Elsa.Metadata.ActivityDescriptor' from assembly 'Elsa.Core, Version=2.7.0.0, Culture=neutral, PublicKeyToken=null'.
Could not load type 'Elsa.Services.Models.IActivity' from assembly 'Elsa.Abstractions, Version=2.7.0.0, Culture=neutral, PublicKeyToken=null'.
Could not load type 'Elsa.Models.WorkflowDefinitionVersion' from assembly 'Elsa.Abstractions, Version=2.7.0.0, Culture=neutral, PublicKeyToken=null'.
Could not load type 'Elsa.Models.WorkflowDefinitionVersion' from assembly 'Elsa.Abstractions, Version=2.7.0.0, Culture=neutral, PublicKeyToken=null'.
Could not load type 'Elsa.Models.WorkflowDefinitionVersion' from assembly 'Elsa.Abstractions, Version=2.7.0.0, Culture=neutral, PublicKeyToken=null'.
Could not load type 'Elsa.Models.WorkflowDefinitionVersion' from assembly 'Elsa.Abstractions, Version=2.7.0.0, Culture=neutral, PublicKeyToken=null'.
Could not load type 'Elsa.Models.WorkflowDefinitionVersion' from assembly 'Elsa.Abstractions, Version=2.7.0.0, Culture=neutral, PublicKeyToken=null'.
Could not load type 'Elsa.Models.WorkflowDefinitionVersion' from assembly 'Elsa.Abstractions, Version=2.7.0.0, Culture=neutral, PublicKeyToken=null'.'
I followed the QuickStart line by line and can't see anything wrong.

Related

ImageCropper.forms getting error's

Keep getting this error can't compile because of it, any help?
Duplicate Java type found! Mappings between managed types and Java types must be unique. First Type: 'Com.Theartofdev.Edmodo.Cropper.CropImageView+IOnSetImageUriCompleteListenerImplementor, Binding_AndroidImageCropper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'; Second Type: 'Xamarin.Android.ImageCropper.CropImageView+IOnSetImageUriCompleteListenerImplementor, Xamarin.Android.ImageCropper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' ParTimers.Android

While implementing Maps in Xamarin, I got following Error

Error: Could not load file or assembly 'Xamarin.Forms.Xaml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies

DrawerLayout Exists in Both Support.Core.UI and V4.Widget

I had a project with a DrawerLayout using Android.Support.Widget.v4
when i wanted to use a recyclerview and after installing Support.v7.RecyclerView and its dependencies im getting this error :
Error CS0433
'DrawerLayout' exists in 'Xamarin.Android.Support.Core.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null' and 'Xamarin.Android.Support.v4,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'

Test project scans my controllers twice

I've created a github repo for this specific post which can be found at https://github.com/CrazyInCode/WebApiNServiceBus
What I'm trying to do is to write tests for my WebApi application. In my specs tests I'm...
Creating a HttpClient to consume the WebApi
Calling my WebApi via the HttpClient
Serializing the result into a list
Assuring that a call to NServiceBus has been made
All this can be found here.
I'm also using StructureMap which I guess scans my ApiControllers. It appears that also NServiceBus scans my ApiControllers, cause when I try to run my tests I get the error:
Multiple types were found that match the controller named 'values'. This can happen if the route that services this request ('api/{controller}/{id}') found multiple controllers defined with the same name but differing namespaces, which is not supported. The request for 'values' has found the following matching controllers: WebApiNServiceBus.Proj.Controllers.ValuesController WebApiNServiceBus.Proj.Controllers.ValuesController
It's not simple to actually spot the error. I have to...
Put an breakpoint at line 21 and 26 in Global.cs (Specs project)
Debug the test and make sure the test stop at the first breakpoint
Browse http://localhost:81/ValService/api/values/assets which will just load...
Continue the test and make sure the test stops at last breakpoint
See the results in the web browser
If I remove all lines which contain IBus, and perform the above steps - the test passes. Clearly NServiceBus has something to do with the test failing.
As I previously stated, it appears that NServiceBus scans my assemblies for controllers. To prevent this, I have tried adding this line in Global.cs to specify what NServiceBus should scan - but without success.
Configure.With(Enumerable.Empty<Assembly>());
The main components in the solution is WebApi, NServiceBus, StructureMap, FakeItEasy and SpecFlow.
I'm stuck. How can I make my test pass?
Edit: Perhaps the solution is to make WebApi not register Controllers - just leave it up to NServiceBus? How can I try this?
Update: as of FakeItEasy 1.19.0, this should not happen. FakeItEasy will only scan for on-disk assemblies if you explicitly ask for this behaviour by implementing a custom Bootstrapper.
I don't know how StructureMap and NServiceBus work, but as luck would have it, just this morning I published a blog post about how FakeItEasy scans assemblies, and I think it has some answers for you.
The highlights: the copies of assemblies that you see, and that #Aliostad listed using System.AppDomain.CurrentDomain.GetAssemblies(), are shadow copies, almost certainly made by the ReSharper test runner. You can instruct the runner not to make these copies.
FakeItEasy before version 1.13 would scan all assemblies in the App Domain and all DLLs in the application directory - this would cause duplicate assemblies to be loaded when shadow copying was on.
With 1.13, there are two optimizations. The first is that if an assembly is already loaded, it won't reload it from the filesystem if the locations match. Unfortunately, shadow copies defeat this check.
The second optimization may help you - FakeItEasy will load assemblies from disk for reflection only, and if an assembly doesn't reference FakeItEasy, it won't be fully loaded, and its types won't be scanned. Since many fewer assemblies should be fully loaded, you may avoid your duplicate type problem.
I suggest picking up FakeItEasy 1.13. Try it both with shadow copies on and off. Heck, even just turning off shadow copies with your current version may help.
This might not be the answer you might be looking for but these assemblies are loaded twice (just use System.AppDomain.CurrentDomain.GetAssemblies()):
System.AppDomain.CurrentDomain.GetAssemblies()
{System.Reflection.RuntimeAssembly[70]}
[0]: {mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089}
[1]: {JetBrains.ReSharper.TaskRunnerFramework, Version=6.1.1000.82, Culture=neutral, PublicKeyToken=1010a0d8d6380325}
[2]: {System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089}
[3]: {System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089}
[4]: {JetBrains.ReSharper.UnitTestRunner.nUnit, Version=6.1.1000.82, Culture=neutral, PublicKeyToken=1010a0d8d6380325}
[5]: {System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a}
[6]: {nunit.core.interfaces, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77}
[7]: {nunit.core, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77}
[8]: {nunit.util, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77}
[9]: {WebApiNServiceBus.Proj.Specs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null}
[10]: {System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35}
[11]: {StructureMap, Version=2.6.4.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223}
[12]: {System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089}
[13]: {TechTalk.SpecFlow, Version=1.9.0.77, Culture=neutral, PublicKeyToken=0778194805d6db41}
[14]: {nunit.framework, Version=2.6.2.12296, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77}
[15]: {Anonymously Hosted DynamicMethods Assembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null}
[16]: {System.Web.Http.SelfHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35}
[17]: {System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089}
[18]: {WebApiNServiceBus.Proj, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null}
[19]: {System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a}
[20]: {System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089}
[21]: {SMDiagnostics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089}
[22]: {System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35}
[23]: {System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089}
[24]: {Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed}
[25]: {System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35}
[26]: {Microsoft.VisualStudio.Debugger.Runtime, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a}
[27]: {NServiceBus, Version=3.3.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c}
[28]: {FakeItEasy, Version=1.7.4626.65, Culture=neutral, PublicKeyToken=eff28e2146d5fd2c}
[29]: {Castle.Core, Version=3.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc}
[30]: {FakeItEasy, Version=1.7.4626.65, Culture=neutral, PublicKeyToken=eff28e2146d5fd2c}
[31]: {log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821}
[32]: {Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed}
[33]: {NServiceBus.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c}
[34]: {NServiceBus, Version=3.3.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c}
[35]: {nunit.framework, Version=2.6.2.12296, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77}
[36]: {StructureMap, Version=2.6.4.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223}
[37]: {System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35}
[38]: {System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35}
[39]: {System.Web.Http.SelfHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35}
[40]: {System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35}
[41]: {TechTalk.SpecFlow, Version=1.9.0.77, Culture=neutral, PublicKeyToken=0778194805d6db41}
[42]: {WebApiContrib.IoC.StructureMap, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null}
[43]: {WebApiNServiceBus.Proj, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null}
[44]: {WebApiNServiceBus.Proj.Specs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null}
[45]: {Castle.Core, Version=3.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc}
[46]: {System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089}
[47]: {System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089}
[48]: {System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a}
[49]: {System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35}
[50]: {System.Transactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089}
[51]: {log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821}
[52]: {System.ComponentModel.Composition, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089}
[53]: {System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a}
[54]: {System.Data.SqlXml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089}
[55]: {System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a}
[56]: {System.ServiceModel.Internals, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35}
[57]: {System.Runtime.DurableInstancing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35}
[58]: {System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089}
[59]: {System.Messaging, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a}
[60]: {System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a}
[61]: {Microsoft.Transactions.Bridge, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a}
[62]: {System.Web.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a}
[63]: {DynamicProxyGenAssembly2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=a621a9e7e5c32e69}
[64]: {WebApiContrib.IoC.StructureMap, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null}
[65]: {Accessibility, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a}
[66]: {System.Configuration.Install, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a}
[67]: {System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35}
[68]: {System.DirectoryServices.Protocols, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a}
[69]: {System.Xml.Linq, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089}
And when you actually look at the location, here it is what it shows:
System.AppDomain.CurrentDomain.GetAssemblies()[43].Location
"C:\\Users\\alik\\GitHub\\WebApiNServiceBus\\WebApiNServiceBus.Proj.Specs\\bin\\Debug\\WebApiNServiceBus.Proj.dll"
System.AppDomain.CurrentDomain.GetAssemblies()[44].Location
"C:\\Users\\alik\\GitHub\\WebApiNServiceBus\\WebApiNServiceBus.Proj.Specs\\bin\\Debug\\WebApiNServiceBus.Proj.Specs.dll"
System.AppDomain.CurrentDomain.GetAssemblies()[9].Location
"C:\\Users\\alik\\AppData\\Local\\Temp\\nfx3urho.nhb\\WebApiNServiceBus.Proj.Specs\\assembly\\dl3\\6d69b640\\baacb725_f5f7cd01\\WebApiNServiceBus.Proj.Specs.dll"
System.AppDomain.CurrentDomain.GetAssemblies()[18].Location
"C:\\Users\\alik\\AppData\\Local\\Temp\\nfx3urho.nhb\\WebApiNServiceBus.Proj.Specs\\assembly\\dl3\\180be185\\4a3f842e_f3f7cd01\\WebApiNServiceBus.Proj.dll"
This is I believe to do with the way unit tests are run.

Assembly created by Moles in VS2010 is referencing MVC3 and MVC4 after install of VS2012

Assembly 'dllname.Moles, Version=1.2.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
A MVC3 solution targetting the .NET4.0 framework, with a unittest project using the Moles framework, worked perfectly in Visual Studio 2010. MVC4 was not installed on this computer.
After installation of Visual Studio 2012 (and the mandatory in place replacement of .NET4.0 by .NET4.5 and the installation of MVC4), the unittest project doesn't compile anymore in VS2010, it complains about the given error.
When we inspect the assembly, we see effectively that it is referencing MVC4 and MVC3??
BoneSoft.CSS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
itextsharp, Version=5.1.2.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca
Microsoft.ExtendedReflection, Version=0.94.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Microsoft.Moles.Framework, Version=0.94.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
NHibernate.Validator, Version=1.3.1.4000, Culture=neutral, PublicKeyToken=70154e18752585bd
System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Runtime.Caching, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
MVC4 is never referenced in the whole solution, but Moles somewhere thinks it must be included when generating a 'moles assembly' of a assembly who is referencing MVC3.
I have also moles assemblies of other assemblies who are not referencing MVC3 and there no problem at compiling time.
I deleted already the moles assembly in the project, rebuilded and recreated the moles assembly: same error.
Ideas where to search the problem?
When you installed VS 2012, it installed MVC4 on the box. MVC 3 wont work well SxS with MVC 4. You need to update MVC 3 app to work on machine where MVC 4 is installed.This is documented in release notes for MVC 4.0. Please read section Installing ASP.NET MVC 4 breaks ASP.NET MVC 3 RTM applications. Follow setps "Required updates".
I was getting a similar error on a project so I removed the reference to MVC and re-added the reference to MVC 3, then I was able to compile.
Looking at the .csproj file, before it read:
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
and after re-adding the reference:
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
So it looks like the tag <SpecificVersion>False</SpecificVersion> was letting the project look for the reference to the newer version of MVC, which was causing the version conflict.

Resources