Very strange behaviour on VS 2005

S

Steve B.

Hi,

I encountered some problem with the debugger of Visual 2005 with CF Apps.

I finaly succeed in isolating hte problem. My application use a
"FormManager" class that handle some common behaviours of all forms.
This "FormManager" class also have a "StartApplication" methode which
contains the Application.Run call. The "FormManager" class is located in a
separate assembly inside the same solution, along other classes.

So the "Main" method should look like this :

static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[MTAThread]
static void Main()
{
FormManager.Default.StartApplication("frmMain"); // Use some reflection to
launch a new frmMain form
}
}


If I keep the code exactly like this, I can't debug the code. When I launch
the application with the F5 key, the application fires and immediatly close.
The debugger then throw an error :
"The remote connection to the device has been lost. Please verify the device
connection and restart debugging", even I put a breakpoint in the main
method.

After some hours (too much :( ), I change the code to this :

static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[MTAThread]
static void Main()
{
string s = "";
FormManager.Default.StartApplication("frmMain");
}
}

The line "string s = "";" is enough to enable the debugger to work correctly
!!!!

I'm very surprised by this behaviour. Moreover this worked perfectly when
the project was build with VS 2003 and CF 1.0.

Do you have any idea about how correcting this behaviour ?
May it be a VS 2005 bug ?

Thanks,
Steve
 
G

Guest

Probably an optimizer tweak that went awry. I would imagine they did not test
reflecting on startup.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 

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