Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

NullReferenceException in bitmap constructor

15 views
Skip to first unread message

Mehmet AVSAR

unread,
Apr 21, 2010, 3:11:34 AM4/21/10
to
Hi,

I'm using Resco components for UI enhancement. When setting
Resco.ImageButton's ImageDefault property like below, I get an exception of
NullReferenceException on Bitmap.ctor(). Looking at the stack trace, inner
exception message says "value does not fall within the expected range". And
since the exception occurs on different thread, I cannot catch it.

this.ibSubeGiris.ImageVgaDefault =
((System.Drawing.Image)(resources.GetObject("ibSubeGiris.ImageVgaDefault")));

What's strange is;
- Exception only occurs on Win CE, while it works well on Win Mobile
- I can't get the exception on debug mode. It just pops out when running on
release mode.

After googling a little, I found some check points:
- Is resource namespace different than the executing assembly's namespace.
Nope.
- Is ImageName an empty string. Nope.
- The file ImageName refers to does not exist. Nope.

Since it works well on Win Mobile, I don't think it's an issue about
resources. And the inner exception message (value not in the range) makes me
think that Windows CE handles threads in a different way than Windows
Mobile, and Resco has some bug there. Resco denies.

Any idea is appreciated.

Regards,
Mehmet AVSAR

Paul G. Tobey [ eMVP ]

unread,
Apr 21, 2010, 2:32:01 PM4/21/10
to
No. Windows Mobile *is* Windows CE. The shell is different and certain
settings that are flexible for Windows CE device OEMs are fixed by Microsoft
for Windows Mobile OEMs, but the operating system is the same. Threads work
the same. This is a Resco/You issue. One of you is doing something wrong.

Paul T.

Vladimir Gregor

unread,
Sep 19, 2011, 6:42:52 AM9/19/11
to
Hello Mehmet.

I recommend you to try Bee Mobile iPack. It is a suite of .NET Compact Framework controls which run fine on Windows CE too. TPictureBox allows you to display also PNG images on Windows CE (it is even shipped with PNG image decoder for Windows CE). You can download a trial version at:
http://beemobile4.net/products/ipack

Check out the homepage to see what other people have said about them.

Best regards
Vladimir Gregor

> On Wednesday, April 21, 2010 3:11 AM Mehmet AVSAR wrote:

> Hi,
>
> I am using Resco components for UI enhancement. When setting
> Resco.ImageButton's ImageDefault property like below, I get an exception of
> NullReferenceException on Bitmap.ctor(). Looking at the stack trace, inner
> exception message says "value does not fall within the expected range". And
> since the exception occurs on different thread, I cannot catch it.
>
> this.ibSubeGiris.ImageVgaDefault =
> ((System.Drawing.Image)(resources.GetObject("ibSubeGiris.ImageVgaDefault")));
>
> What's strange is;
> - Exception only occurs on Win CE, while it works well on Win Mobile
> - I cannot get the exception on debug mode. It just pops out when running on
> release mode.
>
> After googling a little, I found some check points:
> - Is resource namespace different than the executing assembly's namespace.
> Nope.
> - Is ImageName an empty string. Nope.
> - The file ImageName refers to does not exist. Nope.
>
> Since it works well on Win Mobile, I do not think it is an issue about
> resources. And the inner exception message (value not in the range) makes me
> think that Windows CE handles threads in a different way than Windows
> Mobile, and Resco has some bug there. Resco denies.
>
> Any idea is appreciated.
>
> Regards,
> Mehmet AVSAR


0 new messages