TeamSpeak3QueryApi icon indicating copy to clipboard operation
TeamSpeak3QueryApi copied to clipboard

Application crashes

Open realbadidas opened this issue 5 years ago • 5 comments

Hello, im using the library for quite a while now, but now its not working anymore. i now commented everything except 1 query and the login out, so i can analyze the problem. but not even the first query works. ` var rc = new TeamSpeakClient("185.230.160.62", 10011); // Create rich client instance await rc.Connect(); // connect to the server await rc.Login("serveradmin", "ddddddd"); // login to do some stuff that requires permission await rc.UseServer(1); // Use the server with id '1'

        var currentClients = await rc.GetClients();

        foreach (var c in currentClients)
        {
                if (c.DatabaseId == 5)
                {
                    await rc.PokeClient(c.DatabaseId, "Der RCon Server wurde gestartet");
                }

` Visual studio says it begins at the foreach loop.

the error is: TeamSpeak3QueryApi.Net.QueryException HResult=0x80131500 Nachricht = An error occurred during the query. Quelle = mscorlib Stapelüberwachung: bei System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) bei System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) bei TeamSpeak3QueryApi.Net.QueryClient.<Send>d__27.MoveNext() bei System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) bei TCPServer.Program.d__8.MoveNext() bei System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_1(Object state) bei System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state) bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) bei System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() bei System.Threading.ThreadPoolWorkQueue.Dispatch() bei System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

One more thing to note: i had to enable "just my code" because before that it said "AsyncMethodBuilder.cs not found". i followed this tutorial for that: https://stackoverflow.com/questions/39167352/debugging-source-not-found-asyncextensions-cs-not-found

i have no clue whats going on cuz it worked before. i hope you can help. Alex

realbadidas avatar Apr 20 '20 10:04 realbadidas

edit: yatqa says that there was an query connection, so it connects but still crashes.

realbadidas avatar Apr 20 '20 10:04 realbadidas

edit 2: I found the issue. rc.pokeclient() is just not working, i dont know why

realbadidas avatar Apr 20 '20 13:04 realbadidas

Hey,

you used the DatabaseId from the Client in the PokeClient function. I butty sure you need the use the ClientId (clid)

clientpoke clid={clientID} msg={text}

almdandi avatar Apr 20 '20 14:04 almdandi

hey, thanks for the reply. i tried it with the clientid, but it still doesn't work. it worked with dbid before, its so weird. i just use some other query now, but still thanks for the reply

realbadidas avatar Apr 20 '20 14:04 realbadidas

Since the exception seems to be a QueryException, the response was valid but the server responded with an error code != 0.

Could you inspect the exception? It has an error property which contains the data the server sent: https://github.com/nikeee/TeamSpeak3QueryAPI/blob/master/src/TeamSpeak3QueryApi/QueryException.cs#L12

The AsyncMethodBuilder is compiler generated code that wraps async/await and doesn't seem to be relevant in this case.

nikeee avatar Apr 20 '20 15:04 nikeee