dotnet / orleans

Cloud Native application framework for .NET
https://docs.microsoft.com/dotnet/orleans
MIT License
10.1k stars 2.04k forks source link

Silo cannot start - could not load assembly Microsoft.Framework.DependencyInjection.Abstractions #866

Closed crodriguezvega closed 9 years ago

crodriguezvega commented 9 years ago

When using the nuget packages from the development build up to and including commit abb5a092264a1109ac1bb3ccf4ffd88d4470f2a2 I get the following error:

WaWorkerHost.exe Error: 0 : [2015-10-03 13:25:18.441 GMT 7 ERROR 100105 OrleansSiloHost 127.0.0.1:11111] !!!!!!!!!! ERROR starting Orleans silo name=Test.Processor_IN_0 Exception= Exc level 0: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Framework.DependencyInjection.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5877a7803848505b' or one of its dependencies. The system cannot find the file specified. at Orleans.Runtime.Startup.ConfigureStartupBuilder.ConfigureStartup(String startupTypeName) at Orleans.Runtime.Silo..ctor(String name, SiloType siloType, ClusterConfiguration config, ILocalDataStore keyStore) at Orleans.Runtime.Silo..ctor(String name, SiloType siloType, ClusterConfiguration config) at Orleans.Runtime.Host.SiloHost.InitializeOrleansSilo()

I get the same error if I try to build the nuget packages locally myself. Any ideas what the problem could be?

gabikliot commented 9 years ago

You need to make sure your project references this assembly and that this assembly is indeed copied to the execution folder.

gabikliot commented 9 years ago

We will look into that. I thought 'Microsoft.Framework.DependencyInjection.Abstractions should be pulled automatically as one of the nuget dependencies of OrleansRuntime.

crodriguezvega commented 9 years ago

I installed both Microsoft.Framework.DependencyInjection and Microsoft.Framework.DependencyInjection.Abstractions and referenced them in my project, but I still get the same error. Would be great if you can take a look. Thanks.

gabikliot commented 9 years ago

Can you make sure it is copied to role execution folder? Usually, it will be enough to specify copy always true in the properties of this reference. If you are not sure where execution folder of the role is, it is printed in the log, which you can see in the emulator window (if you are running with emulator).

crodriguezvega commented 9 years ago

Yes, both of them are copied to the execution folder. I have two roles in a cloud service and initially I only referenced the assemblies in the role that starts up the silo. Just in case I have also referenced the assemblies in the other role (which communicates with the grains), but the error still persists.

gabikliot commented 9 years ago

Can you share your full silo log, at info level?

crodriguezvega commented 9 years ago

Thanks for the quick responses. This is the full silo log:

[fabric] Role Instance: deployment27(91).OrleansTest.Test.Processor.0 [fabric] Role state Busy [fabric] Role state Started [runtime] Role entrypoint . CALLING OnStart(): Test.Processor.WorkerRole Information: OrleansAzureSilos-OnStart called Information: OrleansAzureSilos-OnStart Initializing config Information: OrleansAzureSilos-OnStart called base.OnStart ok=True [runtime] Role entrypoint . COMPLETED OnStart(): Test.Processor.WorkerRole [runtime] Role entrypoint . CALLING Run(): Test.Processor.WorkerRole Information: OrleansAzureSilos-Run entry point called Information: OrleansAzureSilos-OnStart Starting Orleans silo [WaWorkerHost.exe] Starting Orleans.Runtime.Host.AzureSilo v1.0.10.0 (Release). [WaWorkerHost.exe] [2015-10-03 20:50:06.787 GMT 7 INFO 100423 OrleansSiloHost ] Setting silo type Secondary [WaWorkerHost.exe] [2015-10-03 20:50:07.646 GMT 10 INFO 100801 OrleansSiloInstanceManager ] Attached to Azure storage table OrleansSiloInstances
[WaWorkerHost.exe] [2015-10-03 20:50:07.675 GMT 7 INFO 100434 OrleansSiloHost ] Setting silo Liveness Provider Type=AzureTable
[WaWorkerHost.exe] [2015-10-03 20:50:07.684 GMT 7 INFO 100434 OrleansSiloHost ] Setting silo Reminder Service Provider Type=AzureTable
[WaWorkerHost.exe] [2015-10-03 20:50:07.700 GMT 7 INFO 100434 OrleansSiloHost ] Setting Expected Cluster Size to=1
[WaWorkerHost.exe] [2015-10-03 20:50:07.713 GMT 7 INFO 100270 OrleansSiloInstanceManager ] Registering silo instance: OrleansSilo [ Deployment=deployment27(91) LocalEndpoint=127.0.0.1 LocalPort=11111 Generation=181601406 Host=MY000269 Status=Created ProxyPort=30000 RoleName=Test.Processor Instance=OrleansTest.Test.Processor_IN_0 UpgradeZone=0 FaultZone=0 StartTime=2015-10-03 20:50:06.870 GMT IAmAliveTime=]
[WaWorkerHost.exe] [2015-10-03 20:50:08.185 GMT 7 INFO 100406 OrleansSiloHost ] Setting Deployment Id to deployment27(91) and data connection string to UseDevelopmentStorage=true
[WaWorkerHost.exe] [2015-10-03 20:50:08.195 GMT 7 INFO 100407 OrleansSiloHost ] Setting silo endpoint address to 127.0.0.1:11111:181601406
[WaWorkerHost.exe] [2015-10-03 20:50:08.203 GMT 7 INFO 100408 OrleansSiloHost ] Setting silo proxy endpoint address to 127.0.0.1:30000
[WaWorkerHost.exe] [2015-10-03 20:50:09.071 GMT 7 INFO 100404 Silo 127.0.0.1:11111] Silo starting with GC settings: ServerGC=False GCLatencyMode=Interactive
[WaWorkerHost.exe] [2015-10-03 20:50:09.091 GMT 7 WARNING 100405 Silo 127.0.0.1:11111] Note: Silo not running with ServerGC turned on or with GCLatencyMode.Batch enabled - recommend checking app config : -- and --
[WaWorkerHost.exe] [2015-10-03 20:50:09.103 GMT 7 INFO 100403 Silo 127.0.0.1:11111] -------------- Initializing Secondary silo on host MY000269 MachineName MY000269 at 127.0.0.1:11111, gen 181601406 --------------
[WaWorkerHost.exe] [2015-10-03 20:50:09.137 GMT 7 INFO 100415 Silo 127.0.0.1:11111] Starting silo OrleansTest.Test.Processor_IN_0 with runtime Version='1.0.10.0 (Release).' .NET version='4.0.30319.34209' Is .NET 4.5=True OS version='Microsoft Windows NT 6.2.9200.0' Config= Config File Name: C:\MRLA\project\src\Test.Distributor.CloudService\csx\Debug\roles\Test.Processor\approot\OrleansConfiguration.xml Host: MY000269 Start time: 2015-10-03 20:50:09.114 GMT Primary node: 127.0.0.1:11111 Platform version info: .NET version: 4.0.30319.34209 Is .NET 4.5=True OS version: Microsoft Windows NT 6.2.9200.0 GC Type=Client GCLatencyMode=Interactive Global configuration: System Ids: ServiceId: 00000000-0000-0000-0000-000000000000 DeploymentId: deployment27(91) Subnet: Seed nodes: 127.0.0.1:11111 Messaging: Response timeout: 00:30:00 Maximum resend count: 0 Resend On Timeout: False Maximum Socket Age: 10675199.02:48:05.4775807 Drop Expired Messages: True Silo Sender queues: 8 Gateway Sender queues: 8 Use standard (.NET) serializer: False Buffer Pool Buffer Size: 4096 Buffer Pool Max Size: 10000 Buffer Pool Preallocation Size: 250 Use Message Batching: False Max Message Batching Size: 10 Maximum forward count: 2 Liveness: LivenessEnabled: True LivenessType: AzureTable ProbeTimeout: 00:00:10 TableRefreshTimeout: 00:01:00 DeathVoteExpirationTimeout: 00:02:00 NumMissedProbesLimit: 3 NumProbedSilos: 3 NumVotesForDeathDeclaration: 2 UseLivenessGossip: True IAmAliveTablePublishTimeout: 00:05:00 NumMissedTableIAmAliveLimit: 2 MaxJoinAttemptTime: 00:05:00 ExpectedClusterSize: 1 SystemStore: SystemStore ConnectionString: UseDevelopmentStorage=true Reminders ConnectionString: UseDevelopmentStorage=true Application: Defaults: Deactivate if idle for: 02:00:00

PlacementStrategy: Default Placement Strategy: RandomPlacement Deployment Load Publisher Refresh Time: 00:00:01 Activation CountBased Placement Choose Out Of: 2 Grain directory cache: Maximum size: 1000000 grains Initial TTL: 00:00:30 Maximum TTL: 00:04:00 TTL extension factor: 2.00 Directory Caching Strategy: Adaptive Grain directory: Lazy deregistration delay: 00:01:00 Client registration refresh: 00:05:00 Reminder Service: ReminderServiceType: AzureTable Consistent Ring: Use Virtual Buckets Consistent Ring: True Num Virtual Buckets Consistent Ring: 30 Providers: StorageProviders: Name=MemoryStore, Type=Orleans.Storage.MemoryStorage, Properties=[]

Silo configuration: Silo Name: OrleansTest.Test.Processor_IN_0 Generation: 181601406 Host Name or IP Address: 127.0.0.1 DNS Host Name: MY000269 Port: 11111 Subnet: Preferred Address Family: InterNetwork Proxy Gateway: 127.0.0.1:30000 IsPrimaryNode: True Scheduler: Max Active Threads: 8 Processor Count: 8 Delay Warning Threshold: 00:00:10 Activation Scheduling Quantum: 00:00:00.1000000 Turn Warning Length Threshold: 00:00:00.2000000 Inject More Worker Threads: False MinDotNetThreadPoolSize: 200 .NET thread pool sizes - Min: Worker Threads=8 Completion Port Threads=8 .NET thread pool sizes - Max: Worker Threads=32767 Completion Port Threads=1000 .NET ServicePointManager - DefaultConnectionLimit=200 Expect100Continue=False UseNagleAlgorithm=False Load Shedding Enabled: False Load Shedding Limit: 95 SiloShutdownEventName: Debug: Tracing: Default Trace Level: Info TraceLevelOverrides: Application ==> Info Trace to Console: True Trace File Name: C:\MRLA\project\src\Test.Distributor.CloudService\csx\Debug\roles\Test.Processor\approot\OrleansTest.Test.Processor_IN_0-2015-10-03-20.50.05.649Z.log Write Messaging Traces: False LargeMessageWarningThreshold: 85000 PropagateActivityId: False BulkMessageLimit: 1000 Statistics: MetricsTableWriteInterval: 00:00:30 PerfCounterWriteInterval: 00:00:30 LogWriteInterval: 00:05:00 WriteLogStatisticsToTable: True StatisticsCollectionLevel: Info

[WaWorkerHost.exe] [2015-10-03 20:50:09.183 GMT 7 ERROR 100105 OrleansSiloHost 127.0.0.1:11111] !!!!!!!!!! ERROR starting Orleans silo name=OrleansTest.Test.Processor_IN_0 Exception= Exc level 0: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Framework.DependencyInjection.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=95bf937c3c302943' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) at Orleans.Runtime.Startup.ConfigureStartupBuilder.ConfigureStartup(String startupTypeName) at Orleans.Runtime.Silo..ctor(String name, SiloType siloType, ClusterConfiguration config, ILocalDataStore keyStore) at Orleans.Runtime.Silo..ctor(String name, SiloType siloType, ClusterConfiguration config) at Orleans.Runtime.Host.SiloHost.InitializeOrleansSilo() Exc level 0: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Framework.DependencyInjection.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=95bf937c3c302943' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) at Orleans.Runtime.Startup.ConfigureStartupBuilder.ConfigureStartup(String startupTypeName) at Orleans.Runtime.Silo..ctor(String name, SiloType siloType, ClusterConfiguration config, ILocalDataStore keyStore) at Orleans.Runtime.Silo..ctor(String name, SiloType siloType, ClusterConfiguration config) at Orleans.Runtime.Host.SiloHost.InitializeOrleansSilo() [WaWorkerHost.exe] [2015-10-03 20:50:09.203 GMT 7 INFO 100288 OrleansAzureSilo 127.0.0.1:11111] Successfully initialized Orleans silo 'OrleansTest.Test.Processor_IN_0' as a Secondary node.
[WaWorkerHost.exe] [2015-10-03 20:50:09.214 GMT 7 INFO 100292 OrleansAzureSilo 127.0.0.1:11111] Starting Orleans silo 'OrleansTest.Test.Processor_IN_0' as a Secondary node.
[WaWorkerHost.exe] [2015-10-03 20:50:09.241 GMT 7 ERROR 100105 OrleansSiloHost 127.0.0.1:11111] !!!!!!!!!! ERROR starting Orleans silo name=OrleansTest.Test.Processor_IN_0 Exception= Exc level 0: System.InvalidOperationException: Cannot start silo OrleansTest.Test.Processor_IN_0 due to prior initialization error at Orleans.Runtime.Host.SiloHost.StartOrleansSilo()
Exc level 0: System.InvalidOperationException: Cannot start silo OrleansTest.Test.Processor_IN_0 due to prior initialization error at Orleans.Runtime.Host.SiloHost.StartOrleansSilo() [WaWorkerHost.exe] [2015-10-03 20:50:09.257 GMT 7 ERROR 100285 OrleansAzureSilo 127.0.0.1:11111] !!!!!!!!!! Failed to start Orleans silo 'OrleansTest.Test.Processor_IN_0' as a Secondary node.
Information: OrleansAzureSilos-OnStart Orleans silo started ok=False [WaWorkerHost.exe] [2015-10-03 20:50:09.269 GMT 7 INFO 100289 OrleansAzureSilo 127.0.0.1:11111] OrleansAzureHost entry point called [runtime] Unhandled Exception: System.ApplicationException: Silo failed to start correctly - aborting at Orleans.Runtime.Host.AzureSilo.RunImpl(Nullable`1 cancellationToken) at Orleans.Runtime.Host.AzureSilo.Run() at Test.Processor.WorkerRole.Run() in c:\MRLA\project\src\Test.Processor\WorkerRole.cs:line 65 at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.StartRoleInternal() at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.StartRole() at Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.b__2() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() [fabric] Role state Unresponsive [fabric] Role state Stopped [fabric] Role state Busy

Merroy commented 9 years ago

I have the same problem. the reference is added, files are copied and present in the final Assembly

sergeybykov commented 9 years ago

I suspect maybe the issue is that Microsoft.Framework.DependencyInjection.Abstractions gets strong-named at compile time via the hack that @attilah had to put in in order to make it loadable by strongly named Orleans binaries. Check that the assembly you are referencing is the strong-named one.

Merroy commented 9 years ago

you are right I removed the nuget package c Microsoft.Framework.DependencyInjection.Abstractions.dll and added reference \orleans-master\Binaries\Release\Microsoft.Framework.DependencyInjection.Abstractions.dll and it worked

attilah commented 9 years ago

@sergeybykov let me know if you know the time when I should remove the SN again ;-)

sergeybykov commented 9 years ago

@Merroy Good!

sergeybykov commented 9 years ago

@attilah Do you already have a PR ready?

attilah commented 9 years ago

Not yet, but I can do that 40 minutes work anytime ;-) but save me from the git hell ;-)))

sergeybykov commented 9 years ago

Didn't you have the change as one of the commits as part of one of the versions of the DI PR? If you already have it in a branch, I'd like to take a look. Not urgent though.

attilah commented 9 years ago

I think that does not exists anymore ;-)

sergeybykov commented 9 years ago

No problem, it can wait.

joergbattermann commented 8 years ago

I just started with Orleans and iI installed all the NuGet packages as outlined in the Installation steps into their respective projects but when starting the silo server, the exception

Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified.
Exception = System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
   at Orleans.Runtime.Startup.ConfigureStartupBuilder.ConfigureStartup(String startupTypeName)

Appears on startup and somewhat correctly so - there is no reference to the 'Microsoft.Extensions.DependencyInjection.Abstractions' NuGet package and therefore its assembly/assemblies.

The silo starts up nevertheless, the Exception / Error message is just a tad irritating and reading through the messages above, it seems the DI package should be added & referenced by one of the Orleans packages? (I am installed and am using the v1.2.2 Microsoft.Orleans.* packages)

sergeybykov commented 8 years ago

@jbattermann Take a look at https://github.com/dotnet/orleans/issues/1150. We are likely one week from those DependencyInjection packages getting a stable release.

joergbattermann commented 8 years ago

Ahhh - thanks @sergeybykov :+1:

rosdi commented 8 years ago

This error still happening today even though the Microsoft.Extensions.DependencyInjection.Abstractions package has already been released as stable. As soon as I manually add the package the error goes away.

sergeybykov commented 8 years ago

@rosdi This is already addressed in 1.3.0-beta1. Have you tried it?

rosdi commented 8 years ago

Great... will try later as soon as I completed the tutorial.

naymore commented 7 years ago

Trying to run my OrleansHost.exe...

OrleansHost v1.3.1.0 (Release).
Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from
 HRESULT: 0x80131040)

The assembly is in the bin\debug directory where the OrleansHost.exe is. The assembly however is version 1.1.0 (I had a lot of assembly version mismatches and updated them all to the latest stable version).

Of course I have the necessary Assembly Redirect Bindings in place

      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Extensions.DependencyInjection" publicKeyToken="adb9793829ddae60" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
      </dependentAssembly>

Still, no luck...

P.S. (fixed): OrleansHost.exe does not make any use of app.config. I had to rename it to OrleansHost.exe.config and copy it to the output directory. It's working now.

sergeybykov commented 7 years ago

OrleansHost.exe does not make any use of app.config. I had to rename it to OrleansHost.exe.config and copy it to the output directory. It's working now.

That's the general behavior of .NET config files. At compile time, app.config gets renamed to xyz.exe.config.

rzubek commented 7 years ago

I ran into the same issue as @naymore while following the "standalone silo" tutorial. Starting the collection project as a host threw errors:

System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Sure enough, my version was 1.1.0, because I had to update all packages to make sure all the versions were matching. I also checked app.config and the binding redirects from lower versions were set up correctly. However that wasn't enough. The app was still erroring out.

But - thanks to @naymore for the hint about renaming the app.config file into OrleansHost.exe.config file and setting it to always copy. This made it work.

In short: this tutorial is currently broken when the user has newer versions of DependencyInjection, because app.config does not get automatically renamed and moved to the bin directory (presumably because this is a class library project and not a console project?). However doing this manual rename-and-move described above lets you progress past this step.

sergeybykov commented 7 years ago

@rzubek Does https://github.com/dotnet/orleans/pull/2629 fix this issue? /cc @attilah

attilah commented 7 years ago

@sergeybykov partially yes. But once someone applies package upgrades we cannot do anything about that from our part, beside having a .dll.config OrleansHost.exe.config renamed after build.

rzubek commented 7 years ago

@sergeybykov TBH i'm not sure how to apply that patch to test it - but it does seem like 2616 is describing the same problem

sergeybykov commented 7 years ago

@sergeybykov TBH i'm not sure how to apply that patch to test it

You can build private nugets from master, and try referencing them instead of the ones on nuget.org.

ghost commented 7 years ago

This issue is still relevant, as orleans somehow is struggling with Microsoft.Extensions.DependencyInjection v2.0..

Reverting to 1.1 and manually controlling that all app.configs and other references were updated, worked for us.. but i hope that support for 2.0 is soon implemented.

HansHammel commented 6 years ago

Yepp! Dependency resolution not working properly for Microsoft.Extensions.DependencyInjection, Version=2.0.0.0 AND 1.1.1.0. *Arg* Why is this still haben using a package manager!? BTW: How do you keep binding redirects, actual dependencies and nuget's semantic versioning in sync (across multiple projects)? Recently there was an issues wit the the Microsoft.AspNetCore.All meta package. Very annoying :unamused: