dotnet / dotnet/orleans

Orleans 9.0 With Autofac IGrainExtension

Open
#9,288 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
10.9k
Forks
2.1k
Avg merge
13h 56m
Merged PRs (30d)
351

Description

I upgraded a project to the current orleans version from 3.x
This project also uses autofac for dependency injection.

Now when I start the project, it throws a Argument.Null exception when calling
` CreateHostBuilder(args).Build().Run();` and the source is Autofac.Core.Activators.ProvidedInstance.ProvidedInstanceActivator

After debugging into it I can see autofac tries to register the instance for IGrainExtensions

The code in the ProvidedInstanceActivator is and then register instance fails
```
builder
.RegisterInstance(descriptor.ImplementationInstance) //Is Nulll
.As(descriptor.ServiceType)
.ConfigureLifecycle(descriptor.Lifetime, null);
```

The Registration was added by "UseOrleans()" and i dont have any Grainextensions by my own

In the debug view of the ServiceCollection I can see that it is indeed null

![Image](https://github.com/user-attachments/assets/1588f177-68d4-4497-8a7b-1f29fcf01d08)

Is this some kind of incompability ? How can i do to avoid t his exception?

Contributor guide

Open the contributing guide

Research direction

Start at CreateHostBuilder(args).Build().Run() and inspect the service registrations added by UseOrleans(), then trace the null descriptor into Autofac.Core.Activators.ProvidedInstance.ProvidedInstanceActivator. Done means determining whether the Orleans 9.0 and Autofac integration is incompatible and documenting a verified resolution or workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.