NotSupportedException

S

steve.fillingham

Windows CE 6, .NET Compact Framework 2 (no service pack)

I have a problem whereby my application runs for various periods of
time before throwing a NotSupportedException, the application is
currently deployed into 500+ units which generally run ok but
occasionally need resetting due to this exception. Since the units
would normally get turned on and off on a daily basis the application
is generally not running for more than 24 hours or so, most of the
these sessions run without issue however some sessions generate the
NotSupportedException and eventually require a unit reset.

I have encountered this exception before from a few different
scenarios, the main one generates a Message

Control.Invoke must be used to interact with controls created on a
separate thread.

These have normally been easy to find and fix by using Control.Invoke
as the message suggests. No problem, however my logs show a
NotSupportedException with a Message of

NotSupportedException

Not very helpful message. Not only that but looking at the stack
trace shows methods which have worked millions of times before without
error, they also occur throughout the code base not always in the same
code path, however once a particular code path throws this exception
it will always throw another exception when executed again (without a
reset). The exception is thrown from different threads aswell, the UI
thread, communications threads it even sometimes throws within our
logging code producing a Windows Exception dialog and quitting the
app.

At the moment I am at a complete loss as to what is causing the
exceptions to be thrown, the message and stack data feel like red
herrings.

I have checked that it is not caused by low memory, the application
generally will have 50% of the 128MB free it may go up and down by a
few MB during usage but it is well clear of running out of memory. I
have even simulated low memory conditions whilst the application runs
by having a background thread just eat memory, eventually an
OutOfMemoryException is thrown and the application ofcourse crashes.
The logs contain plenty of OutOfMemoryExceptions but no instance of
NotSupportedException so I think it is not memory related, it has a
different signature.

Googling this particular signature of NotSupportedException has turned
up nothing.

Our application uses a 3rd party unmanaged DLL which performs CPU
intensive operations such as mapping and speech. My current thoughts
are that if the unmanaged DLL is perhaps occasionally trashing managed
memory (stack, JITed code) that it may cause the managed code to act
this way, is this possible ? We are currently trialling some units
with the managed DLL disabled and are yet to see any instance of the
error, but this will not confirm anything for a few weeks since it
does not occur frequently enough.

I will also be trialling an updated CE 6 image with latest service
packs and also .NET CF SP2.

Any ideas anyone ??

Steve
 
C

Chris Tacke, eMVP

It probably is memory related. My guess is you run out of virtual space and
then a call is needed, which in turn tries to load a DLL and fails, which
then cascades back as a not supported exception. Run it through RPM and
look at your GC Heap.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com
 
S

steve.fillingham

It probably is memory related.  My guess is you run out of virtual space and
then a call is needed, which in turn tries to load a DLL and fails, which
then cascades back as a not supported exception.  Run it through RPM and
look at your GC Heap.

--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded communityhttp://community.OpenNETCF.com

Thanks Chris, I will take a look at that. To your knowledge is the
Heap that JIT code is compiled into read-only/execute memory or is it
read-write .. if its read-write then it would be possible for errant
code to corrupt JITed code and I doubt the CLR would be able to detect
this and auto recompile. I was hoping CE would support the Win32
GetProcessHeaps() method to retrieve all the heaps allocated by the
application I could then possibly find the JIT heap and test what
happens if I did corrupt it. At the moment this is issue is giving me
an absolute thrashing and it can only get worse.

Cheers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top