Emulator Method Size Problem

M

ME

I have a somewhat "heavy" form that loads up in my application (Visual
Studio .net 2003, C#). By heavy I mean I have 1972 lines of code that run
in the InitializeComponent method of the form (yeah it has a lot of
controls). On the real pocketpc 2003 device, 2110 iPaq, it loads with no
problems. However if I switch to the emulator it will not load the
InitializeComponent method at all. If I put the method in a try/catch it
simply just forgets to initialize ANYTHING.

As a troubleshooting technique I split the method in half, placing half the
code in the constructor and the leaving the other half in method. The
application suddenly begins to work. As a final test I placed all the code
from the method in my constructor. Sure enough when all the code is in the
constructor the the application errors out when the constuctor is called.

It sounds to me like a memory allocation problem with the emulator, but how
would I get it around it long term? I can not leave the code split as the
IDE will gag when I try to view the form in Design mode. Not to mention the
code in the InitializeComponent method is pretty much wrote for me.

Any help on this would be greatly appreciated.

Thanks,

Matt
----------------------------------------------------------


Code used to generate the form from another class:
----------------------------------------------------
form1 form = new form1()

form.Show()


Constuctor of the form NORMALY - NOT WORKING IN EMULATOR:
---------------------------------------------------
public frmListCalls()
{
InitializeComponent();
}


public void InitializeComponent()
{
1972 lines of initilization of controls code... (real basic stuff,
textboxes, combos, tab pages, etc, events)
}

Constuctor of the form TEMP WORK AROUND (WORKS IN EMULATOR):
---------------------------------------------------
public frmListCalls()
{
986 lines of initilization of controls code... (real basic stuff,
textboxes, combos, tab pages, etc, events)
InitializeComponent();
}


public void InitializeComponent()
{
986 lines of initilization of controls code... (real basic stuff,
textboxes, combos, tab pages, etc, events)
}


Constuctor of the form 3RD TEST - NOT WORKING IN EMULATOR:
---------------------------------------------------
public frmListCalls()
{
1972 lines of initilization of controls code... (real basic stuff,
textboxes, combos, tab pages, etc, events)
InitializeComponent();
}


public void InitializeComponent()
{

}
 
G

Guest

No, it's a known and well described limitation of the CF. Every method has
a maximum IL size. You're at the border where it's over. The only woraround
is to do as you've tested and split InitializeComponents. For more info see
the FAQ in the wiki: wiki.opennetcf.org.

-Chris
 

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