You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit edab8d2
Browse filesBrowse the repository at this point in the historyBrowse files
| SPLATDI004 | Error | Constructor marked with `[DependencyInjectionConstructor]` is not accessible | Changes to `public` or `internal`|
309
+
| SPLATDI005 | Error | Registered types depend on each other through their constructors in a cycle | Manual fix required |
310
+
| SPLATDI006 | Warning | A service is registered more than once with the same contract | Manual fix required |
311
+
| SPLATDI007 | Error | A constructor takes `Lazy<T>` of a service that is not registered with `RegisterLazySingleton`| Manual fix required |
308
312
309
-
The analyzer detects issues in real-time and offers automatic fixes via Quick Actions (Ctrl+. or Cmd+.).
313
+
The analyzer detects issues in real-time and offers automatic fixes via Quick Actions (Ctrl+. or Cmd+.). SPLATDI005 to SPLATDI007 need every registration in the project, so the source generator reports them when it runs.
310
314
311
315
## How It Works
312
316
@@ -317,37 +321,35 @@ The source generator follows a four-step process:
317
321
3. Code Generation - Generates optimized registration code with no reflection
318
322
4. Incremental Builds - Only regenerates when relevant code changes
319
323
320
-
Generated code example:
324
+
The code generated for the [Complete Example](#complete-example):
321
325
322
326
```csharp
323
-
// Generated by Splat.DependencyInjection.SourceGenerator
Transient registrations are made before lazy singletons. A missing dependency throws an `InvalidOperationException` naming its type, from a `ThrowNotRegistered` helper written into the same file.
345
+
346
+
## Performance
347
+
348
+
- No reflection at run time: resolving a service allocates only the objects it constructs, and a registration with no dependencies creates its factory delegate once
349
+
- Full Native AOT and trimming support
350
+
- Builds: a generation pass over 128 registrations takes 9.6 ms and allocates 1.8 MB, and an IDE edit elsewhere in the project reruns it in 8.2 ms. An edit that only moves registrations does not regenerate the file
345
351
346
-
Compared to reflection-based DI:
347
-
- Approximately 100x faster registration execution (no runtime reflection)
348
-
- Approximately 10-100x faster incremental builds (only processes changed files)
349
-
- Full AOT support (works with Native AOT and trimming)
350
-
- Zero runtime overhead (all work done at compile-time)
352
+
The benchmarks, and how to reproduce these figures, are in [src/benchmarks/README.md](src/benchmarks/README.md).
351
353
352
354
## Troubleshooting
353
355
@@ -402,7 +404,7 @@ We welcome contributions! Here's how you can help:
402
404
3. Documentation: Help improve our examples and docs
403
405
4. Testing: Add test cases for edge scenarios
404
406
405
-
See our [contribution guidelines](CONTRIBUTING.md) for details.
407
+
See the [ReactiveUI contribution guide](https://www.reactiveui.net/contribute/index.html) for details.
0 commit comments