Morten Steenbach

I have a strange problem, where a declaration of a dataset is causing the device to loose its connection through activesync while debugging.

Here is my code:

Form1.cs
--------------------------------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace TestDeviceDebugging
{
public partial class Form1 : Form
{
public DataSet testDS = new DataSet("my dataset");
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
System.Xml.XmlTextReader xmlReader = new System.Xml.XmlTextReader("
http://10.10.1.2:8015...........");
testDS.ReadXml(xmlReader);
xmlReader.Close();
}
}
}
-------------------------------------------------------------------
When I debug the app on the WM2005 device, ActiveSync shows that the connection to the device is lost just after deployment. I'm still able to debug, and stop at break points etc, but when I get to 'testDS.ReadXml(xmlReader)' I get a WebConnection exception.

As soon as I move the declaration of the dataset inside the button1_Click event - the connection to the device is active throughout the debugging process. And I can use the internet connection through activesync.

Any ideas




Re: Smart Devices VB and C# Projects Loosing connection to device

Guang-Ming Bian - MSFT

Hi Morten Steenbach,

  1. You say that Activesync is lost , you still can debug, I am confused. Base on my knowledge, if activesync connection lost, you can't debug any more.
  2. Your webconnection exception is that you don't set a completed url to XmlTextReader

I have tried your code, both works fine. below is my code:

Code Snippet

public partial class Form3 : Form

{

DataSet testDS = new DataSet("my dataset");

public Form3()

{

InitializeComponent();

}

private void Form3_Load(object sender, EventArgs e)

{

}

private void button1_Click(object sender, EventArgs e)

{

System.Xml.XmlTextReader xmlReader = new System.Xml.XmlTextReader("http://10.10.1.2:8015...........");

testDS.ReadXml(xmlReader);

xmlReader.Close();

}

}






Re: Smart Devices VB and C# Projects Loosing connection to device

Morten Steenbach

Hi again,

1. I'm running Vista on the development PC. When I deploy the app to the mobile device, it shows 'connected' in Windows Mobile Devices dialog (former ActiveSync). As soon as the app starts executing on the device, the status changes to 'disconnected'.

And yes, I'm still able to debug, so I must have some kind of connection to the device.

Just the internet connection, stops working.
When i move the declaration of the DataSet into a method - the Windows Mobile Devices dialog shows 'connected' all the way, and internet connection works on the device.

2. I altered the url before posting the code for privacy reasons - it works, don't worry:-)

And the latest news: When I run the app without debugging, it works with the declaration of the DataSet in the gobal scope.

This is a really weird problem!





Re: Smart Devices VB and C# Projects Loosing connection to device

Guang-Ming Bian - MSFT

Hi Morten Steenbach,

Yes it is a really weird problem. I can't reproduce it . Can you reproduce the problem on other device or emulator

Please check it .

Best regards,

Guang-Ming Bian - MSFT






Re: Smart Devices VB and C# Projects Loosing connection to device

Morten Steenbach

Unfortunately I haven't got another device available right now, but I'm working on it - I will get back about that.

I can't reproduce it on the emulator, because the emulator doesn't appear in Vista's 'Mobile Devices' when I dock it.

So that's another problem:-)