I am trying to utilize the RedeemMatchMakerTicket call...
I am having issues getting the async methods to work.
I found several entries here in the forums about deadlocking, and have tried all the proposed solutions and nothing is working.
If I try to simply await the playfab method in an Async function, the application crashes, like this
public async void RedeemMatchMakerTicket(IClient client, string lobbyID, string ticket) { RedeemMatchmakerTicketRequest request = new RedeemMatchmakerTicketRequest(); request.LobbyId = lobbyID; request.Ticket = ticket; var response = await PlayFabServerAPI.RedeemMatchmakerTicketAsync(request).ConfigureAwait(false); if (response.Error != null) { WriteLog(response.Error.ErrorMessage, LogType.Error); } if (response.Result != null) { RedeemTicketCallback(client, response.Result); } }
If instead I try to manually run a task, as outlined here in the forums, i get an exception pointing at the DoPost method in the server sdk, like this
public void RedeemMatchMakerTicket(IClient client, string lobbyID, string ticket) { RedeemMatchmakerTicketRequest request = new RedeemMatchmakerTicketRequest(); request.LobbyId = lobbyID; request.Ticket = ticket; bool working = true; var response = PlayFabServerAPI.RedeemMatchmakerTicketAsync(request); response.ContinueWith((result)=>{ working = false; }); while(working) { Console.Write("working..."); } if (response.Exception != null) { WriteLog(response.Exception.Message, LogType.Error); } if (response.Result != null) { RedeemTicketCallback(client, response.Result); } }
I get this exception
at PlayFab.Internal.PlayFabHttp.<DoPost>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at PlayFab.PlayFabServerAPI.<RedeemMatchmakerTicketAsync>d__67.MoveNext()
Any ideas?