Skip to content

Conversation

@tarekgh
Copy link
Member

@tarekgh tarekgh commented Aug 16, 2023

Fixes #83393

These source generators generate code using nullable feature which not supported before C# 8. The change here is require at least C# 8 for source generation.

Candidate to port to rc1

@tarekgh tarekgh requested a review from jeffhandley as a code owner August 16, 2023 02:22
@ghost ghost assigned tarekgh Aug 16, 2023
@ghost
Copy link

ghost commented Aug 16, 2023

Tagging subscribers to this area: @dotnet/area-extensions-logging
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #83393

These source generators generate code using nullable feature which not supported before C# 8. The change here is require at least C# 8 for source generation.

Candidate to port to rc1

Author: tarekgh
Assignees: -
Labels:

area-Extensions-Logging

Milestone: -

@tarekgh tarekgh added this to the 8.0.0 milestone Aug 16, 2023
@tarekgh
Copy link
Member Author

tarekgh commented Aug 16, 2023

@eiriktsarpalis can you please help review this as I am planning to post to rc1? Thanks!

@stephentoub
Copy link
Member

These source generators generate code using nullable feature which not supported before C# 8.

Is this only about use of ? or are there other things it's guarding?

@tarekgh
Copy link
Member Author

tarekgh commented Aug 16, 2023

Is this only about use of ? or are there other things it's guarding?

Yes. Mostly about ? and !.

@tarekgh
Copy link
Member Author

tarekgh commented Aug 16, 2023

/backport to release/8.0

@github-actions
Copy link
Contributor

Started backporting to release/8.0: https://github.com/dotnet/runtime/actions/runs/5885027700

<value>C# language version not supported by the source generator.</value>
</data>
<data name="LoggingUnsupportedLanguageVersionMessageFormat" xml:space="preserve">
<value>The Logging source generator is not available in C# '{0}'. Please use language version '{1}' or greater.</value>
Copy link
Member

Choose a reason for hiding this comment

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

I think we should be removing quotes from both places rather than adding them. We control the version enum that is being passed in both cases, so there's no need to guard with quotes.

I'll submit a new PR changing this.

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not seeing having the quotes is bad to show in the message.

Copy link
Member

Choose a reason for hiding this comment

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

Quotes are typically used to delimit inputs that might contain arbitrary values, including whitespace. We control the inputs passed to the diagnostic and it's kind of weird to say C# '8'.

Copy link
Member

Choose a reason for hiding this comment

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

I created a PR but somehow didn't add you as a reviewer:

#90720

Copy link
Member Author

Choose a reason for hiding this comment

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

Quotes are typically used to delimit inputs that might contain arbitrary values, including whitespace. We control the inputs passed to the diagnostic and it's kind of weird to say C# '8'.

Not necessary, sometimes the quotes can be used to emphasize the info inside the quote. Anyway, I don't mind either way. I'll take a look at the PR.

@ghost ghost locked as resolved and limited conversation to collaborators Sep 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Logging source generator generates uncompilable code for new .NET Framework project

3 participants