Random crashes of my app on WP8 phone

Usually when someone runs into a black screen on WP8, it’s because they attempt to use a feature that’s not supported by Corona on WP8 yet.  Although, if this were the case, you should see a Lua runtime error of some kind in the Visual Studio output panel.  Maybe you should double check that Lua is able to print to Visual Studio’s output panel okay (it should).  Try putting a print() function in your “main.lua” to see if it gets outputted to Visual Studio correctly.

Another thing to double check is to make sure that all of your Corona project files are actually getting bundled into the WP8 *.xap file.  You have to explicitly tell Visual Studio to do this by settings the file’s “Build Action” property to “Content”.  Have a look at the instructions here…

   http://docs.coronalabs.com/daily/coronacards/wp8/portapp.html#copying-project-files

Also, calling display.newText() will work and is okay to do.  In fact, it makes sense to use display.newText() on WP8 if you’re fetch text from a source that you don’t have any control over, such as Twitter or Facebook.  It’s just very slow to generate the text bitmap on WP8.

One last thing.  Which build CoronaCards build # are you using?

In Visual Studio’s “Solution” panel, if you left click on your project’s “References\Corona Framework” node, it’ll show the version in the Properties panel.

Hi Joshua,

My Corona Framework version is 14.0.2511.0. This is the last public release. Has a lot changed for Corona Cards WP8 in the daily builds?

I’m not using any special feature for the app, it’s actually quite basic… I’m using AdMob for ads.  I do have Widget Candy but that’s in my Settings scene, which I didn’t use during the times it crashed.   I had already set the Built Action to Content, like it said in the porting guide.

The LUA print() command works fine in the Output console when the Nokia or emulator is running, and that’s how I was able to get those memory stats in my other reply.

I looked up the -2147220978 (0x8004020e) error code on google, and it means “Unable to find a trustee name that corresponds to a security identifier provided by the user.”     Could that have something to do with the license file?

I could share my project folder with you privately if you’d like to check it out.

>> I could share my project folder with you privately if you’d like to check it out.

That would be a big help.  Because I’m just guessing at what the cause is at this point.  You can just zip up your project and submit it to us via the “Report a Bug” link at the top of this web page.  Also, mention my name (Joshua Quick) and provide a link to this forum thread in the bug report too.  That way our tech-support group will know to send it my way.  Oh and we’d appreciate if you would click “Build\Clean” in the Visual Studio menu to delete all of the compiled files before zipping it up too.  :slight_smile:

I should have time to look into this early next week.

Other than that, I’m not sure how else to help.  You could try the newest daily build, but we haven’t made may WP8 specific changes since the last release other than core features that were implemented on all platforms.  There is only 1 outstanding bug in Corona on WP8 that I’m aware of where a Lua print() with message that is over 10 kb will cause a crash, but that’s an extreme edge case that won’t happen to most people.  I’ll have that issue fixed by next week.  There was a known black screen issue that would happen to some people after doing a suspend/resume, but that was fixed by build #2506 (I looked it up).

Great, thanks a lot, I’ll try to do that if I can’t manage to fix it.   In the meantime I’m going to try the daily build.

Appreciate your help…

Hi Joshua, have you had a chance to look at my bug report?

Sorry about the late response.  Yes, I’ve had a chance to play with your app.

I wasn’t able to reproduce the crash running build #2583.  Although I had AdMob disabled when I tested it.  I’m wondering if that had anything to do with it, but I also know other Corona developers got AdMob working just fine on WP8.  I played it until I won the game a few times, but no crashes.  Are you able to get it to crash consistently anywhere?

I tested your app on a low-end Nokia Lumia 620 running OS version 8.0.

I also tested it on a Nokia Lumia 920 running OS version 8.1

I just tested your app again using a Nokia Lumia 635 that I just acquired today.  I also enabled AdMob so that your code will display its interstitial ads (seems to always display when you start a new game from the main menu).  It’s still not crashing on me.  I also suspended/resumed your app several times and all of the image reloaded fine.  As well as disabling WiFi and the AdvertiserId in case it had an effect on AdMob.

The only crasher that we’ve found on WP8 recently is if you attempt to print() a string containing a ‘%’ character.  I don’t think your app does that, but it’s something we’ve found and fixed in a recent daily build.

Thanks so much for taking the time to look into it. I’m surprised it did not happen on yours. I had bizarre artifacts on my 635 too sometimes when it didn’t crash. Later I had the same shutdown issue when building a different app, which was a math quiz game.

One thing to note is that the emulator in Visual Studio froze once when playing the original game. So I’m wondering if there is something that may have been corrupted during the build process. I built and ran it many times though. I will clean out my output folder and rebuild it and try again.

The only other thing I haven’t done yet is test with the exact CoronaCards build # that you are building with.  I was using a fairly recent daily build.

I had tried the last public build for CoronaCards and later the latest daily build (from last week). When I have a chance again I’ll try with the latest build and clean out my build folder and let you know how it goes.

Interesting, I just tried it on the Debug x86 emulator for the 4-inch 512MB device, and while i was playing, the game board suddenly went all black. I pressed the New Game button and then the app shut down. I got that same -2147220978 (0x8004020e) error too, which I had only seen on the phone previously.

According to http://www.symantec.com/business/support/index?page=content&id=TECH12638, that error code refers to:
“Unable to find a trustee name that corresponds to a security identifier provided by the user.”

And at https://msdn.microsoft.com/en-us/library/windows/desktop/dd542643%28v=vs.85%29.aspx
“Cannot modify or delete an object that was added using the COM+ Admin SDK”

I also ran it on the actual phone. In one instance of the game, when both the player and computer have had a turn, I pressed the red Home button. When it went back to the main menu the background was black and the text on the buttons was blotted out by black. (See photo below)

I’m using the latest build of CoronaCards.

MepxdQnl.jpg

I’m not sure what else I can do to help you.  I’ve tested it on 3 different WP8 devices and I can’t reproduce it.  And no one else is running into this problem either.

The only thing I can think of is that you’re not actually running the Corona library build # that you think you are.  My last bit of advice is to add a…

   print("Corona Build = " … tostring(system.getInfo(“build”))

…to your “main.lua” file.  This will print the build # of the Corona library.  If it’s not using the same build # that you are using in Visual Studio, then you have an incremental build issue.  If that’s the case, then you need to delete your app from the WP8 device, and then do a clean build in Visual Studio via the “Build\Rebuild” in the menu.

Hi,
According to the debug info that you suggested, I am using build 2015.2589, which was the latest build from a few days ago when I installed it. I have also rebuilt it from scratch and loaded it onto my phone.

Just now I played two full games. At the end of the second game, when the Game Over overlay asked if I wanted to play again or go Home, I selected Home. I ended up getting the same screen shown in the screenshot in my last reply (blackened background, blackened text, no title banner).

Next, I pressed the “Settings” option (third option in the menu) and the settings screen came up, but with the black background.

Went back to the main menu and everything went back to normal (title, menu options), but the background was still black.

So, I selected a One Player game, and the screen froze at black. Then I got the following show up in Visual Studio:

“An unhandled exception of type ‘System.OutOfMemoryException’ occurred in System.Windows.ni.dll
Additional information: Insufficient memory to continue the execution of the program.”

The strange thing is, I had no memory issues or leaks when when I ran the Corona memory debug output. I never had these strange issues in Android and iOS with the same app either. This is a very basic game so I don’t see how memory usage could be that high.

I couldn’t get a stacktrace dump because apparently I need to turn off something (forgot what it was, but I turned it off now). I’ll try to get more info later. If I can’t get this to work, I’m just going to give up and return this $100 phone to Microsoft and deal with the $20 spent on developer registration. I can’t afford to waste my time on this anymore. :frowning:

Another thing -  I’m wondering if adding the GoogleAds.dll by reference is causing memory issues?

I did add Google AdMob’s library reference to your project too and got interstitial ads working.

Just try adding the print() statement I mentioned up above to verify that you are actually building with that version of the Corona library, because your builds might not actually be getting deployed to your device.  That would explain the strange errors that you are getting.  I’m thinking that you are either running into an incremental build issue or an app deployment issue with Visual Studio.  It’s rare, but it’s happen to me in the past as well.  The only way to work-around that issue is to delete the app from your device yourself and clean/rebuild your app.

Yes, I already mentioned 2 posts above:

“According to the debug info that you suggested, I am using build 2015.2589”         <-- I used the print statement you suggested in my main.lua.

I don’t remember if I deleted the app, but I’ll delete it and rebuild from scratch again.

EDIT: Bah, never mind.  I got the exact same memory issue / black background glitch again, by reproducing the steps above after playing 2 games.

I also notice someone else had a similar issue with the black glitches with the same phone (Nokia 635):

http://forums.coronalabs.com/topic/52167-notes-on-porting-to-wp8/#entry271013

Apparently he fixed it by not calling storyboard:removeAll(); but I am using Composer.

 

I am probably going to give up on this and forget WP8.

The black glitches you see in that forum thread was fixed months ago, in build #2484, as can be seen in the link below.  And I know both of these gentlemen were using AdMob as well.

   http://forums.coronalabs.com/topic/52032-unscramble-anagram-corona-app-on-the-windows-phone-store/?p=271957

The only other thing I can think of is that somehow you’re having debugger issues.  Instead of running your app via the Visual Studio debugger, try running your app manually on your device.

Hi Joshua, 

So I tried it again with the phone disconnected from the computer.  I managed to play a couple games, went back to main menu, went to settings, back to main menu etc.   No issues.

However, afterwards when I started a new game, and then went back to the main menu (without rolling dice), I got the following happen to my main menu:

G70dQKQl.jpg

It looks like the title banner graphic and the letter graphics on the buttons got replaced by the background image(!) which got squished into that small space. I had seen this before, a couple of times on other days.

I think the only good news since yesterday is that I am no longer seeing random shutdowns (error 0x800402e) on the phone.  And this is probably because i had done a factory reset of the Nokia earlier that day, so that may have somehow taken care of that.   But who knows, maybe I’m just lucky this time.  However it doesn’t solve these strange graphic issues.

I notice i’m using Text Candy in a few places.  I’m going to replace it with bmGlyph and FontManager and see how it goes.

Update:
So I got rid of all occurrences of Text Candy (in three scenes, one overlay) and replaced them with FontManager calls. However I have a similar issue still, after I play a couple games and then alternate between starting a new game and going back to main menu.

4DganGxl.jpg

Background becomes black and title banner is missing. Aaaghhhhhh.