System.NotSupportedException

  • Thread starter Thread starter SDF
  • Start date Start date
S

SDF

I have a CF application that works fine in debug mode if I
go directly to the device. However, if I try to debug
using the Emulator I get System.NotSupportedException
error in the Form's Public Sub New() - specifically
MyBase.New()

Anyone ever encounter this, I'm lost as to what it could
be.

Thnaks,

Scott
 
Scott,

Do you do something in the form constructor or load event handler that might
require a DLL that's missing on the emulator or something like that? Does
the app run ok in the emulator in Release mode?
 
Hi Ginny,

I am not doing anything with the constructor or load
event. The app is using System.Data.SqlClient and
System.Data.SqlServerCE amongst the normal references.

I get the same error when debugging in Release mode, too.

Thanks for your time on this...

Scott
 
Scott,

Have you tried stepping throught the debugger to determine exactly where the
error is occuring?
 
Ginny,

Yes, I have stepped through it and it faults at MyBase.New() - I'm really at
a loss, I've never seen this before.

Scott
 
You're not using an inherited Form are you? You're deriving directly from
System.Windows.Forms.Form? Have you tried a hard reset on the emulator? This
should make sure that VS.Net sends the Compact Framework to the device, as
well as any SQL bits that you require, when you deploy your app.
 
Tim,

I have one form, Inherits System.Windows.Forms.Form. I'm
not sure on hard resetting the emulator. But I do notice
that the first debug of the day it does send the CF and
SQL stuff to the emulator.

Scott
 
So you're using the PPC 2002 emulator that comes with VS.Net 2003? Try hard
resetting the emulator. This can be easily done using the menu on the
emulator window.
 
I did the Hard Reset but still get the error. I can run
other app's with the emulator, just not this one. It's
gotta be here somewhere...

thanks for the suggestions!

Scott
 
Have you written a very small app that makes use of SQL Server CE and tried
that on the emulator? If this works then you know with good certainty that
there is something wrong with your application. If this doesn't work then it
might be a problem with the SQL Server CE install on the emulator (somehow).
 
Hello Scott,

Does the form that is causing the error contain many controls? Also, does
the form load properly on an actual device, or on the emulator without
running under the debugger (i.e., via Ctrl+F5)?

Also, if you could email me the code for the form that is causing the
error, I will investigate.

Thanks,
--Joe



--------------------
| Content-Class: urn:content-classes:message
| From: "SDF" <[email protected]>
| Subject: Re: System.NotSupportedException
| Date: Mon, 17 Nov 2003 12:19:00 -0800
|
| I did the Hard Reset but still get the error. I can run
| other app's with the emulator, just not this one. It's
| gotta be here somewhere...
|
| thanks for the suggestions!
|
| Scott
|
| >-----Original Message-----
| >So you're using the PPC 2002 emulator that comes with
| VS.Net 2003? Try hard
| >resetting the emulator. This can be easily done using the
| menu on the
| >emulator window.
| >
| >--
| >Tim Wilson
| >Windows Embedded MVP
| >| >> Tim,
| >>
| >> I have one form, Inherits System.Windows.Forms.Form.
| I'm
| >> not sure on hard resetting the emulator. But I do
| notice
| >> that the first debug of the day it does send the CF and
| >> SQL stuff to the emulator.
| >>
| >> Scott
| >>
| >> >-----Original Message-----
| >> >You're not using an inherited Form are you? You're
| >> deriving directly from
| >> >System.Windows.Forms.Form? Have you tried a hard reset
| on
| >> the emulator? This
| >> >should make sure that VS.Net sends the Compact
| Framework
| >> to the device, as
| >> >well as any SQL bits that you require, when you deploy
| >> your app.
| >> >
| >> >--
| >> >Tim Wilson
| >> >Windows Embedded MVP
| >> >
| >> >| >> >> Ginny,
| >> >>
| >> >> Yes, I have stepped through it and it faults at
| >> MyBase.New() - I'm really
| >> >at
| >> >> a loss, I've never seen this before.
| >> >>
| >> >> Scott
| >> >>
| >> >>
| >> >> "Ginny Caughey [MVP]"
| >> >message
| >> >> | >> >> > Scott,
| >> >> >
| >> >> > Have you tried stepping throught the debugger to
| >> determine exactly where
| >> >> the
| >> >> > error is occuring?
| >> >> > --
| >> >> > Ginny Caughey
| >> >> > .Net Compact Framework MVP
| >> >> >
| >> >> > | >> >> > > Hi Ginny,
| >> >> > >
| >> >> > > I am not doing anything with the constructor or
| load
| >> >> > > event. The app is using System.Data.SqlClient
| and
| >> >> > > System.Data.SqlServerCE amongst the normal
| >> references.
| >> >> > >
| >> >> > > I get the same error when debugging in Release
| >> mode, too.
| >> >> > >
| >> >> > > Thanks for your time on this...
| >> >> > >
| >> >> > > Scott
| >> >> > >
| >> >> > >
| >> >> > >
| >> >> > >
| >> >> > > >-----Original Message-----
| >> >> > > >Scott,
| >> >> > > >
| >> >> > > >Do you do something in the form constructor or
| >> load event
| >> >> > > handler that might
| >> >> > > >require a DLL that's missing on the emulator or
| >> something
| >> >> > > like that? Does
| >> >> > > >the app run ok in the emulator in Release mode?
| >> >> > > >--
| >> >> > > >Ginny Caughey
| >> >> > > >..Net Compact Framework MVP
| >> >> > > >
| >> >> > > >| >> >> > > >> I have a CF application that works fine in
| debug
| >> mode
| >> >> > > if I
| >> >> > > >> go directly to the device. However, if I try
| to
| >> debug
| >> >> > > >> using the Emulator I get
| >> System.NotSupportedException
| >> >> > > >> error in the Form's Public Sub New() -
| >> specifically
| >> >> > > >> MyBase.New()
| >> >> > > >>
| >> >> > > >> Anyone ever encounter this, I'm lost as to
| what
| >> it could
| >> >> > > >> be.
| >> >> > > >>
| >> >> > > >> Thnaks,
| >> >> > > >>
| >> >> > > >> Scott
| >> >> > > >
| >> >> > > >
| >> >> > > >.
| >> >> > > >
| >> >> >
| >> >> >
| >> >>
| >> >>
| >> >
| >> >
| >> >.
| >> >
| >
| >
| >.
| >
|
 
Hi Joe,
When I do the Ctrl+F5 I still get the error. However, the
form does have a lot of controls. The app contains one
form and about 10 panels, which I swap. Each panel has
it's share of controls. Is there a max number of controls?

Scott
 
Hi Joe,
When I do the Ctrl+F5 I still get the error. However, the
form does have a lot of controls. The app contains one
form and about 10 panels, which I swap. Each panel has
it's share of controls. Is there a max number of controls?

Scott
 
Tim,

I did create a new app with Sql Cthat runs fine in the
emulator. So the problem is at the application level.

Scott
 
Scott,

There's no fixed maximum number of controls that you can have on any given
form. However, for a variety of reasons NetCF has a limit that any
individual method can have a maximum of 64kb of JITed native code. Every
time you add a control to your form, you're adding a bit of code to the
InitializeComponent() method, and depending on what kinds of controls you
have and what properties you've set on them, you can eventually reach a
point where the InitializeComponent method exceeds this limit when it is
JITed. Since this generally happens during form instantiation, the typical
result is that you'll see a NotSupportedException thrown in the form's
constructor. This sounds like the error you're seeing, which makes me
think that it is the complexity of your form that's causing the problem.

There is a FAQ which addresses this issue, as someone already pointed out
in this thread, and it is located here:
http://msdn.microsoft.com/mobility/prodtechinfo/devtools/netcf/faq/default.a
spx#4.10

Unfortunately most of the workarounds are just general suggestions for
"reduce the amount of code in InitializeComponent".

Since you're using multiple panels, it might be fairly straightforward to
split your large single form into multiple forms. (There are some tips for
producing multi-form apps in the same FAQ, in section 4:
http://msdn.microsoft.com/mobility/prodtechinfo/devtools/netcf/faq/default.a
spx#4.0)

Also, if you've added any of your own code to InitializeComponent, you will
probably want to move that into a separate method (or into the form
constructor or the Form.Load event handler). Of course, if you're
modifying the code that the designer itself generates in
InitializeComponent you need to be careful because it is likely that when
you switch back to Design View for the form, the designer will reserialize
the code and clobber your changes.

If you're still running into problems, you can send me the code for the
form that's causing you problems and I will try to help resolve them. (I
was the author of the FAQ item 4.10, so if you also have any suggestions
about improving that FAQ entry, I'd be happy to hear them.)

Thanks,
--Joe


--------------------
| From: <[email protected]>
| Subject: Re: System.NotSupportedException
| Date: Tue, 18 Nov 2003 06:21:24 -0800
|
| Hi Joe,
| When I do the Ctrl+F5 I still get the error. However, the
| form does have a lot of controls. The app contains one
| form and about 10 panels, which I swap. Each panel has
| it's share of controls. Is there a max number of controls?
|
| Scott
|
| >-----Original Message-----
| >Hello Scott,
| >
| >Does the form that is causing the error contain many
| controls? Also, does
| >the form load properly on an actual device, or on the
| emulator without
| >running under the debugger (i.e., via Ctrl+F5)?
| >
| >Also, if you could email me the code for the form that is
| causing the
| >error, I will investigate.
| >
| >Thanks,
| >--Joe
| >
| >
| >
| >--------------------
| >| Content-Class: urn:content-classes:message
| >| From: "SDF" <[email protected]>
| >| Subject: Re: System.NotSupportedException
| >| Date: Mon, 17 Nov 2003 12:19:00 -0800
| >|
| >| I did the Hard Reset but still get the error. I can
| run
| >| other app's with the emulator, just not this one. It's
| >| gotta be here somewhere...
| >|
| >| thanks for the suggestions!
| >|
| >| Scott
| >|
| >| >-----Original Message-----
| >| >So you're using the PPC 2002 emulator that comes with
| >| VS.Net 2003? Try hard
| >| >resetting the emulator. This can be easily done using
| the
| >| menu on the
| >| >emulator window.
| >| >
| >| >--
| >| >Tim Wilson
| >| >Windows Embedded MVP
| >| >| >| >> Tim,
| >| >>
| >| >> I have one form, Inherits
| System.Windows.Forms.Form.
| >| I'm
| >| >> not sure on hard resetting the emulator. But I do
| >| notice
| >| >> that the first debug of the day it does send the CF
| and
| >| >> SQL stuff to the emulator.
| >| >>
| >| >> Scott
| >| >>
| >| >> >-----Original Message-----
| >| >> >You're not using an inherited Form are you? You're
| >| >> deriving directly from
| >| >> >System.Windows.Forms.Form? Have you tried a hard
| reset
| >| on
| >| >> the emulator? This
| >| >> >should make sure that VS.Net sends the Compact
| >| Framework
| >| >> to the device, as
| >| >> >well as any SQL bits that you require, when you
| deploy
| >| >> your app.
| >| >> >
| >| >> >--
| >| >> >Tim Wilson
| >| >> >Windows Embedded MVP
| >| >> >
| >| >> >| >| >> >> Ginny,
| >| >> >>
| >| >> >> Yes, I have stepped through it and it faults at
| >| >> MyBase.New() - I'm really
| >| >> >at
| >| >> >> a loss, I've never seen this before.
| >| >> >>
| >| >> >> Scott
| >| >> >>
| >| >> >>
| >| >> >> "Ginny Caughey [MVP]"
| >| >> >message
| >| >> >> | >| >> >> > Scott,
| >| >> >> >
| >| >> >> > Have you tried stepping throught the debugger to
| >| >> determine exactly where
| >| >> >> the
| >| >> >> > error is occuring?
| >| >> >> > --
| >| >> >> > Ginny Caughey
| >| >> >> > .Net Compact Framework MVP
| >| >> >> >
| >| >> >> > | >| >> >> > > Hi Ginny,
| >| >> >> > >
| >| >> >> > > I am not doing anything with the constructor
| or
| >| load
| >| >> >> > > event. The app is using
| System.Data.SqlClient
| >| and
| >| >> >> > > System.Data.SqlServerCE amongst the normal
| >| >> references.
| >| >> >> > >
| >| >> >> > > I get the same error when debugging in Release
| >| >> mode, too.
| >| >> >> > >
| >| >> >> > > Thanks for your time on this...
| >| >> >> > >
| >| >> >> > > Scott
| >| >> >> > >
| >| >> >> > >
| >| >> >> > >
| >| >> >> > >
| >| >> >> > > >-----Original Message-----
| >| >> >> > > >Scott,
| >| >> >> > > >
| >| >> >> > > >Do you do something in the form constructor
| or
| >| >> load event
| >| >> >> > > handler that might
| >| >> >> > > >require a DLL that's missing on the emulator
| or
| >| >> something
| >| >> >> > > like that? Does
| >| >> >> > > >the app run ok in the emulator in Release
| mode?
| >| >> >> > > >--
| >| >> >> > > >Ginny Caughey
| >| >> >> > > >..Net Compact Framework MVP
| >| >> >> > > >
| >| >> >> > > >| [email protected]...
| >| >> >> > > >> I have a CF application that works fine in
| >| debug
| >| >> mode
| >| >> >> > > if I
| >| >> >> > > >> go directly to the device. However, if I
| try
| >| to
| >| >> debug
| >| >> >> > > >> using the Emulator I get
| >| >> System.NotSupportedException
| >| >> >> > > >> error in the Form's Public Sub New() -
| >| >> specifically
| >| >> >> > > >> MyBase.New()
| >| >> >> > > >>
| >| >> >> > > >> Anyone ever encounter this, I'm lost as to
| >| what
| >| >> it could
| >| >> >> > > >> be.
| >| >> >> > > >>
| >| >> >> > > >> Thnaks,
| >| >> >> > > >>
| >| >> >> > > >> Scott
| >| >> >> > > >
| >| >> >> > > >
| >| >> >> > > >.
| >| >> >> > > >
| >| >> >> >
| >| >> >> >
| >| >> >>
| >| >> >>
| >| >> >
| >| >> >
| >| >> >.
| >| >> >
| >| >
| >| >
| >| >.
| >| >
| >|
| >
| >--
| >This posting is provided "AS IS" with no warranties, and
| confers no rights.
| >
| >.
| >
|
 
Joe,

Thank you for the information, I will certainly look at the FAQ. If worse
comes to worse, I may have you look at the code.

Thanks again,

Scott
 
Tim,

Thank you for your help with this issue. I do beleieve the issue is the
amount of controls and I will test your theory.

Thank you.

Scott
 
Back
Top