Android Question Strange Error Behavior

Computersmith64

Well-Known Member
Licensed User
Longtime User
This one is a little weird, but maybe somebody has an idea of why this is happening:

I have a class (clsNetGame) that I Dim NetGame as clsNetGame in Process_Globals in my Main Activity module. If a player decides to play a single player game or a multiplayer game that isn't a network game, NetGame never gets initialized.

In one sub, I execute an If statement against one of the properties in NetGame - however I forgot to check to see if NetGame was initialized. In the case of a network multiplayer game, you would correctly assume that this isn't an issue, however in a single player or on-device multiplayer game, it is...

So here's where it gets weird. If I compile the app in debug mode & run it on a device, when it hits the If statement & NetGame isn't initialized, I get an "Object was not initialized" runtime exception - as you would expect. BUT, if I compile the app in Release (obfuscated) mode & run it on a device, I get no error whatsover - but I do get a strange behavior that leads me to believe that the code is returning from the sub as soon as it hits the If statement.

Can anyone think of why this would be happening? I thought that it might be something to do with some Try, Catch, End Try blocks I had recently put in other parts of the code, however if I remove these I still see the same behavior - plus they aren't even in the same module...

This isn't causing me an issue anymore (because I simply check to see if NetGame is initialized before the If statement), however it seems like very odd behavior to me & I'd like to understand why a Release vs. Debug compile results in a different behavior.

Thanks - Colin.
 
Top