An expression tree may not contain a reference to a local function

Viewed 6332

Error: An expression tree may not contain a reference to a local function

public void Initialize()
{
    CloudStorageProperties ImageFileProperties(string fileName) => _cloudStorage.GetBlob(CloudStorageType.Image, fileName).FileProperties;

    Config = new MapperConfiguration(x =>
    {
        x.CreateMap<Category, CategoryViewModel>()
            .ForMember(vm => vm.ImagePath, m => m.MapFrom(src => ImageFileProperties(src.ImageFile.Name).Uri.AbsoluteUri));
    });
}

I can replace the local function with an anonymous function and it works but re sharper says that I should convert it to a local function.

Why is this not allowed?

1 Answers
Related