hi,
Is there a way to correctly debug an asynchronous interface?
I am invoking an Asynchronous library function StringGetAsync that is offered by StackExchange.Redis. It takes an array of string as input and feeds back an array of RedisValue [] which effectively is byte[] type.
The below program is returning an array of nulls, and to know the reason - when 3 breakpoints are put one on await line, one on Sleep and one on return statement, after the first breakpoint is executed, the program is exiting with 0 as exit status (possibly success), not letting to examine 2nd and 3rd breakpoints. There is an Add-to-Watch setup with an expression arryOfValuesReceived[0].ToString() to observe the returned array's individual elements, but, the program is exiting after first breakpoint.
May I know the possible reasons for this behaviour or any means to capture and look into returned array, to debug further? thank you
Is there a way to correctly debug an asynchronous interface?
I am invoking an Asynchronous library function StringGetAsync that is offered by StackExchange.Redis. It takes an array of string as input and feeds back an array of RedisValue [] which effectively is byte[] type.
The below program is returning an array of nulls, and to know the reason - when 3 breakpoints are put one on await line, one on Sleep and one on return statement, after the first breakpoint is executed, the program is exiting with 0 as exit status (possibly success), not letting to examine 2nd and 3rd breakpoints. There is an Add-to-Watch setup with an expression arryOfValuesReceived[0].ToString() to observe the returned array's individual elements, but, the program is exiting after first breakpoint.
May I know the possible reasons for this behaviour or any means to capture and look into returned array, to debug further? thank you
C#:
private static async Task<RedisValue[]> GetMeValuesForMyKeys (DataTable table)
{
var batch = new List<RedisKey> (100);
for (i = 0; i<table.Rows.Count; i++)
{
DataRow row = table.Rows[i];
batch.Add(row["keyColumn"].ToString () );
}
RedisValue[] arryOfValuesReceived = await db.StringGetAsync(batch.ToArray() );
Thread.Sleep(10000); // introduced to identify whether above or below statement is the rootcause, and it is noticed that above is the cause
return arryOfValuesReceived
}