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
LightInject.Source will emit warnings when it's pulled in but not compatible with certain project settings available in C# 8.0 and later.
Steps to reproduce
Create a new .NET standard 2.1 library with the below .csproj including LightInject.Source and a stub Class1.cs file (as if created with Visual Studio)
Errors, because LightInject is seemingly written without regard to nullable reference types. Since warnings around null handling are treated as errors in this example, the build fails, so for this kind of configuration, the warnings cannot be simply ignored.
Recommendation
Include #nullable disable in the LightInject.cs file provided in the NuGet package to explicitly announce to the compiler that it is not using the "nullable context" feature (not sure if multitargeting will make this difficult).
Workarounds
Use LightInject instead of LightInject.Source (but then you lose out on the benefits of LightInject.Source).
Do not use a project level <Nullable> property, but define it on a per-file basis.
The text was updated successfully, but these errors were encountered:
LightInject.Source will emit warnings when it's pulled in but not compatible with certain project settings available in C# 8.0 and later.
Steps to reproduce
Desired outcome
No errors, no warnings.
Actual outcome
Errors, because LightInject is seemingly written without regard to nullable reference types. Since warnings around null handling are treated as errors in this example, the build fails, so for this kind of configuration, the warnings cannot be simply ignored.
Recommendation
Include
#nullable disable
in the LightInject.cs file provided in the NuGet package to explicitly announce to the compiler that it is not using the "nullable context" feature (not sure if multitargeting will make this difficult).Workarounds
<Nullable>
property, but define it on a per-file basis.The text was updated successfully, but these errors were encountered: