Error when closing application

ExcludeReality

Active Member
Licensed User
I have a problem with an application. In debug it works fine, but when I compile it I get an error message if I try to close it.
It doesn't matter if I use AppClose or simply press the X button. This has nothing to do with the application itself, because I get the same behaviour on all compiled apps.

I recently replaced the source for CEnhancedLabel, as I was suggested to do here: http://www.b4x.com/forum/questions-help-needed/5471-compile-error.html. Might that be relavent?

Thanks.

4705240297_8a152db204_b.jpg
 

agraham

Expert
Licensed User
Longtime User
It looks from the stack trace that the error occurs when the Form tries to repaint itself with an invalid bitmap. The red cross is what Wwindows paints when a bitmap is invalid. Does this happen on EVERY application however small or is it just on some?
 

ExcludeReality

Active Member
Licensed User
The red cross is what Wwindows paints when a bitmap is invalid. Does this happen on EVERY application however small or is it just on some?

It seems this only happens on larger applications. But I can't find a "common denominator", that is to say something that the failing applications all have in common.

I just remembered that yesterday I installed Compact Framework 2.0. Not sure if that is relavent.
Also, if I try to compile without Optimized Compiliation I get a message saying "Can't find Ilasm.exe" and it directs me to download .NET Framework 1.1.

It looks from the stack trace that the error occurs when the Form tries to repaint itself with an invalid bitmap.

I looked around and found that many people had the same problem, but I didn't find a solution.
They described it as "Graphics is null in the last stack-trace call". I don't know what that means...
 
Last edited:

agraham

Expert
Licensed User
Longtime User
It seems this only happens on larger applications.
I recommend you start stripping a copy of one of them down until it stops happening and then check what you removed last. From the stack trace it looks like the backlayer bitmap is invalid as the first thing the OnPaint code does is to get the width of that bitmap. The only way that I can think that this can happen is if you have assigned Form.Image to a Bitmap and then Disposed the Bitmap.

You said earlier "This has nothing to do with the application itself, because I get the same behaviour on all compiled apps.". If it is only on some apps and not others thern something is triggering it on those apps and not the ones that work OK. Are you doing anything in the Form Close event for the failing apps?
I just remembered that yesterday I installed Compact Framework 2.0. Not sure if that is relavent.
Highly unlikely as from the screenshot the problem seems to appear on the desktop.
it directs me to download .NET Framework 1.1.
It will if you don''t have .NET 1.1 installed on the desktop. I wouldn't bother. Basic4ppc v6.90 and later only support optimised compilation.
 

ExcludeReality

Active Member
Licensed User
Are you doing anything in the Form Close event for the failing apps?

I don't even have Form Close event. As I said earlier, it doesn't matter how I close the application.

EDIT:
I've tried to strip down my application. It seems it only works when the main form has no visible controls at all.
By visible I mean controls that are visible by default, like buttons and labels.

If it is only on some apps and not others thern something is triggering it on those apps and not the ones that work OK.

It doesn't make any sense. I have and old application that was compiled a long time ago. It worked fine before, but when I run it now I have the same problem.
I doubt it has anything to do with the code itself if it worked before and hasn't changed since. I think the problem lies in Basic4ppc itself.
 
Last edited:

RacingDog

Active Member
Licensed User
Hmmm, looks like Graham's gone for his dinner...

Given that old stuff used to work, I'd say it looks like an installation problem, that is different elements from different versions have caused a build incosistency.

I'd a) make sure I had backup of the version of b4ppc for which the old stuff worked, just in case; b) I'd uninstall b4ppc and anything related to it; c) install latest version; d) go round all MY directories making sure Library dlls were all manually replaced from the new installation if the system doesn't do it for you (does it? Graham would know).

I have one third party app written in some unknown language which misbehaves because it can't find .Net CF 1. Everything else seems to work fine with 2.0 or even 3.5. But that is sufficent evidence to say that if the above doesn't work, then make sure you have an old .Net CF for your old stuff as occasionally it is a problem not to have it.
 

ExcludeReality

Active Member
Licensed User
I'd a) make sure I had backup of the version of b4ppc for which the old stuff worked, just in case; b) I'd uninstall b4ppc and anything related to it; c) install latest version; d) go round all MY directories making sure Library dlls were all manually replaced from the new installation if the system doesn't do it for you (does it? Graham would know).

I reinstalled Basic4ppc, rebooted my computer and sure enough, all the apps worked. The strange thing is that they worked without even recompiling!
The issue must have been with Basic4ppc.
I also replaced CEnhancedLabel again, and it worked fine so that wasn't the problem.

Thanks for the help.
 
Top