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

[nullable check]'from clause' should have nullable check in query expression #67370

Closed
bysdxt opened this issue Mar 20, 2023 · 1 comment
Closed
Labels
Area-Compilers Resolution-Duplicate The described behavior is tracked in another issue untriaged Issues and PRs which have not yet been triaged by a lead

Comments

@bysdxt
Copy link

bysdxt commented Mar 20, 2023

Version Used:
.NET SDK 7.0.202
Visual Studio 17.5.2

Code:

#nullable enable
using System;
using System.Linq;
using System.Collections.Generic;
namespace ConsoleApp1 {
    internal class Program {
        static IEnumerable<int> f(IEnumerable<int>? x) {
            return from v in x select v + 1;
        }
        static IEnumerable<int> h(IEnumerable<int>? x) {
            foreach (var v in x)
                yield return v + 1;
        }
        static IEnumerable<int> g(IEnumerable<int>? x) {
            return x.Select(v => v + 1);
        }
        static void Main() {
            Console.WriteLine("Hello, World!");
        }
    }
}

sharplab

Expected Behavior:
All three functions f/h/g are warned about nullable problem
Actual Behavior:
Only function h/g are warned. No warning in function f.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Mar 20, 2023
@jcouv
Copy link
Member

jcouv commented Mar 31, 2023

This is a known issue. We don't track nullability within LINQ queries. Closing as duplicate of #29863

@jcouv jcouv closed this as not planned Won't fix, can't repro, duplicate, stale Mar 31, 2023
@jcouv jcouv added the Resolution-Duplicate The described behavior is tracked in another issue label Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Resolution-Duplicate The described behavior is tracked in another issue untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

No branches or pull requests

2 participants