Skip to content

'await' cannot be used in an expression containing the type 'System.ReadOnlySpan<char>' #774

@majora2007

Description

@majora2007

Describe the bug
When utilizing System.IO.Abstractions for Path.Join, the following code snippet does not compile on .NET 6, however it does when using System.IO Path.Join.

    var path = System.IO.Abstractions.FileSystem.Path.Join("/config/covers", await GetChapterCoverImageAsync(chapterId));
    public async Task<string> GetChapterCoverImageAsync(int chapterId)
        {
    
            return await _context.Chapter
                .Where(c => c.Id == chapterId)
                .Select(c => c.CoverImage)
                .AsNoTracking()
                .SingleOrDefaultAsync();
        }

public class Chapter {
   public string CoverImage { get; set; }
}

Expected behavior
I expect that the Abstraction works identically to System.IO and it builds and functions correctly.

Additional context
I am using .NET 6 and System.IO.Abstractions 14.0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreIssues that address the core abstractions & the wrappersstate: ready to pickIssues that are ready for being worked onstate: releasedIssues that are releasedtype: enhancementIssues that propose new functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions