1

I have an application developed in Visual Studio 2010 incorporating the CSLA.Net framework and FileHelpers Library.

I am using the code below to read a csv file with the file helpers library. I have break points set on every line and it faults after the engine.BeginReadFile. I have tried both csv and txt files on the read function. I even commented out the method i have and used the sample method from filehelpers along with their sample code and received the same error. The code will not progress beyond the engine.BeginReadFile method. It does not make it to the foreach loop at all. the error i receive is :

System.Exception._COMPlusExceptionCode -532462766

I am not very familiar with Visual Studio, but I cannot find any further breakdown of this error. the code in question is below.

using (FileHelperAsyncEngine engine = new FileHelperAsyncEngine(typeof(ProductionSchedule)))
{  
    // To Read Use
    engine.BeginReadFile(filename);

        foreach (ProductionSchedule prodsched in engine)
        {
             // get the connection string properly once a database is available
             using (SqlConnection connection = new SqlConnection(Settings.Default.ConnectionString))
             {
Didier Ghys
  • 30,396
  • 9
  • 75
  • 81
  • Can you read the file using [`File.ReadAllText(filename)`](http://msdn.microsoft.com/en-us/library/system.io.file.readalltext.aspx) in its place? – SliverNinja - MSFT Dec 20 '11 at 19:32
  • 2
    Is there any compelling reason you are using the Async handler? – Ta01 Dec 20 '11 at 19:33
  • According to the answer [here](http://stackoverflow.com/questions/3064542/complus-exception-code-532462766), -532462766 is the general error code for an unhandled exception in a .NET console application. – shamp00 Dec 21 '11 at 09:25

1 Answers1

0

You are using the Async engine but you are not waiting for it to complete from the brief snippet you have given above.

Based on these assumptions, I would suspect that you are attempting to iterate through the collection as it's being changed. Either that or your SQL ConnectionString is invalid.

netniV
  • 2,328
  • 1
  • 15
  • 24