Skip to content

Null guard not working for c# 8 Nullable #72

Description

@dominikjeske

I'm testing library for c# 8 support but it looks like it is not working

public static string Test(string? text) { text.MustNotBeNull(); return text.Substring(0, 1); }

With proper implementation there should be no warrning for text but currently I have:

"Warning CS8602 Dereference of a possibly null reference"

Check is only woring when return value is used

public static string Test(string? text) { var x = text.MustNotBeNull(); return x.Substring(0, 1); }

but I would not like to create separate variable only for this

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions