Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / End command doesn't exit gracefully

Author
Message
JohnStabler
AGK Bronze Backer
11
Years of Service
User Offline
Joined: 16th Aug 2013
Location: Cardiff, Wales, UK
Posted: 7th Sep 2016 21:07
I'm writing a Tier 1 app on Windows 10. I downloaded the latest AppGameKit version this evening (v2.0.21)

When I use the end command I get the following Microsoft Visual C++ Runtime Library error:

"This application has requested the Runtime to terminate it in an unusual way."
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 7th Sep 2016 23:56

Try just dropping off the end of the code... i.e. add a GOTO to a label that is right at the very bottom of the listing (Arrrgh!!! He said "GOTO"!!!!! NOOOOooooooo).

What's the "AGK Coding Club"?
V2 T1 (Mostly)
Phone Tap!
Uzmadesign
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 8th Sep 2016 08:25
wait for .22
AGK (Steam) V2.0.20 : Windows 10 Pro 64 Bit : AMD (16.3.2) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
JohnStabler
AGK Bronze Backer
11
Years of Service
User Offline
Joined: 16th Aug 2013
Location: Cardiff, Wales, UK
Posted: 8th Sep 2016 13:39
@CJB

Dropping off the end of the code is an option; I was just reporting the end command bug to see if other people are getting the same error and to bring it to Paul's attention.

The AppGameKit Code Club: in October I start a coding club in my local primary school. Instead of using Scratch (which seems to be the popular choice) I'm going to be using AppGameKit to teach kids BASIC / procedural programming. AppGameKit seems to be a natural fit IMHO because it's very easy to learn and you can get something cool looking on the screen in no time at all.
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 8th Sep 2016 14:13
Quote: "This application has requested the Runtime to terminate it in an unusual way."

That usually means the program threw an exception but it wasn't caught by the code. I'm not sure what could cause this since AppGameKit catches and displays all exceptions from the interpreter, do you get any errors in the Debug Log when running in debug mode before calling end?

I tried calling end in a simple program on Windows 10 but couldn't replicate the problem, if you're still having problems can you send me the project so I can track it down?
JohnStabler
AGK Bronze Backer
11
Years of Service
User Offline
Joined: 16th Aug 2013
Location: Cardiff, Wales, UK
Posted: 8th Sep 2016 14:22
Hi Paul,

I'll try it again when I get home tonight and if it is still showing the error I'll send you the code.
JohnStabler
AGK Bronze Backer
11
Years of Service
User Offline
Joined: 16th Aug 2013
Location: Cardiff, Wales, UK
Posted: 8th Sep 2016 22:01 Edited at: 8th Sep 2016 22:23
Okay, I found the issue.

I had used SetErrorMode(2) . Once I commented that out I didn't get the Runtime Library error. Instead it takes a second or two and then the game exits without error.

Is this behaviour expected?

Basically what I had was:



The JoinServer() function attempts to connect to a multiplayer game. If it failed then errors were thrown (e.g. socket timeout) and then the function returns -1. Under those circumstances I got the Runtime Library error when it attempted to end.
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 8th Sep 2016 22:07
I remember an issue previously where end would throw an error due to the sound sub-system thread not being killed off properly (or something along those lines) - i.e. the main thread would die, so when the sound system thread tried to communicate with the main thread you'd get the error. I wonder if this is something similar? Those network connection commands are likely to do things asynchronously and may have a child thread hanging around causing trouble after END is called. ...still if dropping SetErrorMode(2) fixes the problem - happy days!
V2 T1 (Mostly)
Phone Tap!
Uzmadesign

Login to post a reply

Server time is: 2024-09-29 19:16:37
Your offset time is: 2024-09-29 19:16:37