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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable nullable explicitly #572

Merged
merged 2 commits into from
Sep 12, 2022
Merged

Disable nullable explicitly #572

merged 2 commits into from
Sep 12, 2022

Conversation

Pliner
Copy link
Contributor

@Pliner Pliner commented Sep 10, 2022

Hey,

We use LightInject(a source code package) as a built-in container for EasyNetQ.

We started a migration to Nullable Reference Types recently and observed build warnings because LightInject doesn't support them(and this is fine).

image

Could you consider adding #nullable disable pragma? It looks like the simplest way how these warnings could be suppressed.

Anyway, thanks for LightInject 馃殌

@Pliner
Copy link
Contributor Author

Pliner commented Sep 10, 2022

This PR fixes #552

@Pliner
Copy link
Contributor Author

Pliner commented Sep 12, 2022

@seesharper Could you review this PR? 馃檹馃徎

@seesharper
Copy link
Owner

Thanks. Makes sense.

@Pliner
Copy link
Contributor Author

Pliner commented Sep 12, 2022

@seesharper Thanks.

/home/runner/work/LightInject/LightInject/src/LightInject/LightInject.cs(1,2): 
error CS8370: Feature 'nullable reference types' is not available in C# 7.3. 
Please use language version 8.0 or greater. 
[/home/runner/work/LightInject/LightInject/src/LightInject/LightInject.csproj]

Let me check what could we do with this error 馃槥

@Pliner
Copy link
Contributor Author

Pliner commented Sep 12, 2022

image

There are the following target frameworks:

<TargetFrameworks>net6.0;netstandard2.0;netcoreapp3.1</TargetFrameworks>

Okay, it looks like we have at least these two options:

  1. Just bump a language version to 8.0 by adding <LangVersion>8.0</LangVersion>. 7.3 looks pretty old, doesn't it? :) This change will affect only netstandard2 source package users who still uses the default version language(7.3).
  2. To introduce a constant, for example, USE_NULLABLE_DISABLE, and initialise it with true for netcoreapp3.1 and net6.0. Source package users will also be able to initialise the constant depending on their curcumstances.

@seesharper Which approach do you prefer?

PS I've committed a fix using the first approach just to speed up merging if you are happy with it.

Copy link
Owner

@seesharper seesharper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@seesharper seesharper merged commit f7d850b into seesharper:master Sep 12, 2022
@Pliner Pliner deleted the patch-1 branch September 12, 2022 16:11
@Pliner
Copy link
Contributor Author

Pliner commented Sep 19, 2022

@seesharper Sorry for bothering you again about this small change. There is a version bump to 6.6.0, but no matching release exists. Could you release it please?

@Pliner
Copy link
Contributor Author

Pliner commented Sep 19, 2022

@seesharper Thanks for the release! I've checked and it works perfectly 馃憤馃徎

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

Successfully merging this pull request may close these issues.

None yet

2 participants