Skip to content

Void async method can crash whole CSharRepl #197

Description

@kindermannhubert

Version

last

What happened?

The following code is able (there is a race condition) to crash CSharpRepl:
(EDIT: not sure about race condition now, but I believe I saw non-crashing evaluations of this)

async Task Method1() => await Method2(async () => await File.ReadAllTextAsync(""));
async Task Method2(Action action) => /*missing await*/ action();
await Method1()

WindowsTerminal_CcKCch2lzv

Exception Info: System.ArgumentException: The value cannot be an empty string. (Parameter 'path')
   at System.ArgumentException.ThrowNullOrEmptyException(String argument, String paramName)
   at System.IO.File.Validate(String path, Encoding encoding)
   at System.IO.File.ReadAllTextAsync(String path, Encoding encoding, CancellationToken cancellationToken)
   at Submission#1.<>c.<<Method1>b__1_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()

Activity

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions