Exception when using .? operator for nullable fields
See original GitHub issueLooks like the following will try to create Nullable for Nullable.
    class Scope
    {
        public int? Value { get; set; }
    }
    
    class Program
    {
        static void Main(string[] args)
        {
            var interpreter = new Interpreter();
            var lambda = interpreter.Parse("Scope?.Value", new Parameter("Scope", typeof(Scope)));
            var result = lambda.Invoke(new Scope());
            Console.WriteLine(result);
        }
    }
this will throw an exception
 System.ArgumentException: GenericArguments[0], 'System.Nullable`1[System.Int32]', on 'System.Nullable`1[T]' violates the constraint of type 'T'.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
 Top Results From Across the Web
Top Results From Across the Web
c# - System.NullReferenceException when using null ...
The most probable cause is that FirstOrDefault() returns null (as a default value) and thus FirstOrDefault().Name throws exception.
Read more >(null-forgiving) operator - C# reference
Learn about the C# null-forgiving, or null-suppression, operator that is used to declare that an expression of a reference type isn't null.
Read more >Null Conditional Operators in C# - ?. and ?[]
When we have nullability enabled, we need to respond to the warnings that come up in our code. This often means performing null...
Read more >Null Pointer Exception In Java
NullPointerException is thrown when program attempts to use an object reference that has the null value.
Read more >Understanding null safety
A deep dive into Dart language and library changes related to null safety.
Read more > Top Related Medium Post
Top Related Medium Post
No results found
 Top Related StackOverflow Question
Top Related StackOverflow Question
No results found
 Troubleshoot Live Code
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free Top Related Reddit Thread
Top Related Reddit Thread
No results found
 Top Related Hackernoon Post
Top Related Hackernoon Post
No results found
 Top Related Tweet
Top Related Tweet
No results found
 Top Related Dev.to Post
Top Related Dev.to Post
No results found
 Top Related Hashnode Post
Top Related Hashnode Post
No results found

Oh I didn’t see your pull request. There’s actually an existing method that does the check already:
GenerateNullableTypeConversion.Thanks @halamah and @metoule for bug report and fix! New version is on the way …