Appalling debugging times

P

Peter Morris

Hi all

My app scans a subfolder .\DataImporterPlugins\*.dll for assemblies, loads
them in, finds classes that implement IDataImporter, then creates an
instance of that class and shoves it into a list.

In the menu I can then select an instance and the main form will run the
Execute method of that class. What confuses me though is why the debugger
takes 30 seconds every time I hit F10 to execute the next line of code?


MainForm
=======
if (dataImporter.Prepare())
{
try
{
new Thread(delegate()
{
Thread.Sleep(1000);
dataImporter.Execute(ecoSpace, form);
}).Start();
form.ShowDialog();
}
finally
{
dataImporter.CleanUp();
}
}



DataImporter
=========
public bool Prepare()
{
OpenFileDialog ofd = new OpenFileDialog();
using (ofd)
{
ofd.CheckFileExists = true;
ofd.CheckPathExists = true;
ofd.DefaultExt = "*.xml";
ofd.Filter = "Xml files|*.xml";
ofd.FileName = FileName;
if (ofd.ShowDialog() == DialogResult.OK)
{
FileName = ofd.FileName;
return true;
}
return false;
}
}




public void Execute()
{
**************Breakline on the next line***************
XmlFileStream = new FileStream(FileName, FileMode.Open, FileAccess.Read,
FileShare.Read);
Stream xsdStream =
GetType().Assembly.GetManifestResourceStream("AirSoftware.Velocity.DataImport.Xml.AirfieldData.xsd");
XmlReader xsdReader = new XmlTextReader(xsdStream);
XmlSchema xsdSchema = System.Xml.Schema.XmlSchema.Read(xsdReader, null);

XmlReaderSettings readerSettings = new XmlReaderSettings();
readerSettings.ValidationType = ValidationType.Schema;
readerSettings.Schemas.Add(xsdSchema);

readerSettings.ValidationEventHandler += new
ValidationEventHandler(readerSettings_ValidationEventHandler);

XmlReader = XmlTextReader.Create(XmlFileStream, readerSettings);

try
{
while (XmlReader.Read() && !Abort)
{
 
P

Peter Morris

PS: If I remove the ShowDialog() method call I get acceptible response time.
Why would showing this form make any difference?


Thanks

Pete
 

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

Similar Threads

Datagridview problem 1

Top