BuildServiceProvider does not activate service
- Dominant language
- No language data
- Stars
- 4.8k
- Forks
- 6.1k
- Avg merge
- 19h 10m
- Merged PRs (30d)
- 268
Description
### Type of issue
Code doesn't work
### Description
The following example is wrong:
```csharp
using Microsoft.Extensions.DependencyInjection;
var services = new ServiceCollection();
services.AddActivatedSingleton();
ServiceProvider provider = services.BuildServiceProvider();
```
BuildServiceProvider() doesn't activate the service.
### Page URL
https://learn.microsoft.com/en-us/dotnet/core/extensions/dependency-injection/auto-activation?tabs=dotnet-cli
### Content source URL
https://github.com/dotnet/docs/blob/main/docs/core/extensions/dependency-injection/auto-activation.md
### Document Version Independent Id
5bbf9150-5b16-c5e3-7207-906fa7c0c132
### Platform Id
5e9b375b-bdce-6e92-5158-77e0ccc96940
### Article author
@gewarren
### Metadata
* ID: 079daeaa-bb2a-5574-e909-225118b018a5
* PlatformId: 5e9b375b-bdce-6e92-5158-77e0ccc96940
* Service: **dotnet-fundamentals**
[Related Issues](https://github.com/dotnet/docs/issues?q=is%3Aissue+is%3Aopen+5bbf9150-5b16-c5e3-7207-906fa7c0c132)
---
[Associated WorkItem - 576158](https://dev.azure.com/msft-skilling/Content/_workitems/edit/576158)
Contributor guide
Assessment
This issue has not been assessed yet.