Appalling debugging times
am 02.10.2007 23:38:26 von Peter MorrisHi 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.Ve locity.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)
{