Many interview questions are asked for purposes other than seeing how you write code. Usually the questions are a little vague to find out what clarifying questions you ask - your questions determine how well you do it. Writing code on the board is secondary at best.
I was tasked with creating an asynchronous shell over some long running method, processing some data
First question: is this long-running method asynchronous? If so, then Task.Run
would not be necessary. But if not ...
Follow-up question: if it is not asynchronous, right? Ie, is it I / O-based? If so, then we could take the time to make it asynchronous. But if not ...
The next question is: if we need a shell for the task (around processor-based code or around blocking I / O code), is the environment acceptable for the shell? Ie, is this a desktop / mobile application, not the code that will be used in ASP.NET?
create it to run only one task at a time.
Clarification of questions: if the second request arrives when it is already running, the second request is "queued"? Or is it a "merge" with an existing query? If they are merges, do they need to โdiscardโ the input - or some subset of the input?
Each of these questions changes the way the answer is constructed.
Publication of an open method and a public event.
It could be what left him. Between Task<T>
/ IProgress<T>
and Rx events are rarely needed. They really should only be used if you are working in a team that does not recognize Rx.
Oh, and don't worry about the โfailureโ of the interview. I have failed more than 2/3 of my interviews during my career. Iโm just talking badly.