Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw Exception if Missing Splat Registrations #120

Open
mysteryx93 opened this issue Jan 26, 2022 · 2 comments
Open

Throw Exception if Missing Splat Registrations #120

mysteryx93 opened this issue Jan 26, 2022 · 2 comments
Labels

Comments

@mysteryx93
Copy link

Using Splat for Dependency Injection, I'm noticing that if a class is initialized and there are missing registrations, it will pass null to the constructor and I won't know about it. Is there a way to make it "fail early" and tell me there's a missing registration to build the object?

@glennawatson
Copy link
Contributor

How are you doing your splat registrations?

May be worth using the new source generator package https://www.nuget.org/packages/Splat.DependencyInjection.SourceGenerator/

@mysteryx93
Copy link
Author

mysteryx93 commented Jan 27, 2022

With Source Generator, actually.

This is a registration that caused me trouble because of a dependency that wasn't registered, was null, and would just throw a random error at runtime.

SplatRegistrations.RegisterLazySingleton<IAppPathService, AppPathService>();

@glennawatson glennawatson transferred this issue from reactiveui/splat Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants