Skip to content

Given example throws exception #4

@graemejob

Description

@graemejob

RoslynPad code:

#r "nuget: ExpressionDelegates.Base, 1.0.0"
using ExpressionDelegates;
using System.Linq;
using System.Linq.Expressions;

Expression<Func<string, int>> expression = s => s.Length;
MemberInfo accessorInfo = ((MemberExpression)expression.Body).Member;

Accessor lengthAccessor = ExpressionDelegates.Accessors.Find(accessorInfo);

**var value = lengthAccessor.Get("17 letters string");** 

ExpressionDelegates.Accessors.Find returns null, so .Get causes a null reference exception.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions