autofac / autofac/Examples

Restore a Service Fabric example (deleted in cae30c6)

Open
#31 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
400
Forks
347
Avg merge
26m
Merged PRs (30d)
9

Description

The Service Fabric sample no longer exists in this repo, and both the Autofac docs and this repo's README still refer to it.

## What happened

`src/ServiceFabricDemo/` was deleted in cae30c6 ("Convert from AppVeyor to GitHub Actions CI"), which also replaced `Examples.sln` with `Examples.slnx`. The sample was an old-style .NET Framework app — `packages.config`, `app.config`, a `.sfproj` — so it presumably didn't survive the modernization, but the removal left two dangling references behind.

It contained these projects, and is recoverable from history as a starting point (`git show cae30c6^:src/ServiceFabricDemo/...`):

- `AutofacServiceFabricDemo` — the `.sfproj` application package
- `DemoStatelessService`
- `DemoStatefulService`
- `DemoActor` and `DemoActor.Interfaces`
- `DemoShared` — `ILogger` / `Logger` / `LoggerModule`

## Dangling references to clean up

- `README.md` line 17 still says the `Examples.sln` file has every sample "*except* the ServiceFabric example. ServiceFabric is in a child directory and has its own solution." Both halves are now wrong: the file is `Examples.slnx`, and there is no ServiceFabric directory.
- The Autofac documentation linked to `autofac/Examples/tree/master/src/ServiceFabricDemo` from its Service Fabric integration page. That link was dead twice over — deleted directory, and `master` renamed to `main` — so the Example section has been removed from the docs page in autofac/Documentation#188. It should be restored, pointing here, once a sample exists again.

## What a replacement should cover

This is also the follow-up for [Autofac.ServiceFabric#26](https://github.com/autofac/Autofac.ServiceFabric/issues/26), which asked for the sample to be brought up to date and is being closed in favor of this issue. A rebuilt sample would ideally show:

- `RegisterServiceFabricSupport` plus `RegisterStatelessService` / `RegisterStatefulService` / `RegisterActor`
- A dependency that consumes `ServiceContext`, registered `InstancePerMatchingLifetimeScope("ServiceFabric")` — the `SingleInstance` pitfall is a recurring support question
- The `configurationAction` hook, ideally with the Application Insights `FabricTelemetryInitializer` scenario
- Current SF package versions, all aligned, on a modern SDK-style project

## Note on effort

Worth being honest that this is not a small task and is the most expensive item in the current Service Fabric cleanup. Building and validating it needs a real Service Fabric cluster: there's no native macOS runtime, and while a Linux `onebox` Docker image exists, the docs around it are stale. A Windows or Ubuntu environment, or an Azure cluster, is realistically required to verify the sample actually runs rather than merely compiles.

Help here would be genuinely welcome from anyone actively working with Service Fabric.

Contributor guide

Open the contributing guide

Research direction

Start with git show cae30c6^:src/ServiceFabricDemo/... and review the deleted projects, then check README.md and the Autofac Service Fabric documentation reference. Rebuild the sample with the listed Autofac.ServiceFabric registrations, dependency lifetime and configuration scenarios, update the dangling references, and validate it in a supported Windows, Ubuntu, or Azure Service Fabric environment rather than only compiling it.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend, distributed-systems, documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.