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

Nullability issue #127

Open
mrblumi opened this issue Apr 20, 2024 · 0 comments
Open

Nullability issue #127

mrblumi opened this issue Apr 20, 2024 · 0 comments

Comments

@mrblumi
Copy link

mrblumi commented Apr 20, 2024

Hi there. First of all thank you for this brilliant library :)
Today I discovered the following little issue when trying to register a service like the following

[RegisterScoped]
public class Service : IService<Input, string?>;
public class Input : IInput<string?>;

public interface IService<TInput, TOutput> where TInput : IInput<TOutput>;
public interface IInput<TOutput>;

Usually I am working in an environment with

<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>

And I am getting the following error

Injectio.g.cs(25,45): Error CS8631 : The type 'ServiceType' cannot be used as type parameter 'TIn' in the generic type or method 'IService<TIn, TOut>'. Nullability of type argument 'ServiceType' doesn't match constraint type 'IType<string>'.

Sure enough it can be solved by disabling the TreatWarningsAsErros flag temporary. But I think the problem exists because the used SymbolDisplayFormat.FullyQualifiedFormat is lacking the SymbolDisplayMiscellaneousOptions.IncludeNullableReferenceTypeModifier flag...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant