You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using System;using System.Threading;using System.Threading.Tasks;namespaceStepOverAwait{publicinterfaceIMessage{}publicclassRequest:IMessage{}publicclassReply:IMessage{}publicclassCallResult<T>whereT:IMessage{publicreadonlyTresult;publicCallResult(Tresult)=>this.result =result;}publicinterfaceICallInvoker{Task<CallResult<TReply>>InvokeAsync<TRequest,TReply>(TRequestrequest)whereTRequest:IMessage,new()whereTReply:IMessage,new();}publicclassCallInvoker:ICallInvoker{publicasyncTask<CallResult<TReply>>InvokeAsync<TRequest,TReply>(TRequestrequest)whereTRequest:IMessage,new()whereTReply:IMessage,new(){await Task.Delay(1000);//if you debug and step over this, unity will crashreturnnewCallResult<TReply>(new TReply());}}classMainClass{CancellationTokenSourcects=new CancellationTokenSource();ICallInvokerinvoker;TasktaskB;booldone;voidAwake(){invoker=new CallInvoker();taskB= MethodAsync();}voidUpdate(){if(taskB.IsCompleted){
Console.WriteLine("success");done=true;}}publicstaticvoidMain(string[]args){
Console.WriteLine("Hello World!");varc=new MainClass();
c.Awake();while(!c.done){
Thread.Sleep(1000/60);
c.Update();}}asyncTask<int>MethodAsync(){varreply=await invoker.InvokeAsync<Request,Reply>(new Request());await Task.Delay(5);return0;}}}
Put a breakpoint on the line that reads:
await Task.Delay(1000); //if you debug and step over this, unity will crash
Run under the debugger, hit the breakpoint, step over.
Current Behavior
Runtime crash in get_this_async_id
* Assertion at debugger-agent.c:4547, condition `is_ok (error)' not met, function:get_this_async_id, Could not execute the method because the containing type 'System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[StepOverAwait.CallResult`1[TReply_REF]]', is not fully instantiated. assembly:<unknown assembly> type:<unknown type> member:(null)
Expected Behavior
No crash.
On which platforms did you notice this
[X] macOS
[] Linux
[X] Windows
Version Used:
6.6.0.166 (2019-08/d9001b5ae70 Wed Feb 12 19:20:16 EST 2020)
The text was updated successfully, but these errors were encountered:
Steps to Reproduce
await Task.Delay(1000); //if you debug and step over this, unity will crash
Current Behavior
Runtime crash in
get_this_async_id
Expected Behavior
No crash.
On which platforms did you notice this
[X] macOS
[] Linux
[X] Windows
Version Used:
6.6.0.166 (2019-08/d9001b5ae70 Wed Feb 12 19:20:16 EST 2020)
The text was updated successfully, but these errors were encountered: