Cinchoo / ChoETL.NACHA

A NACHA library for .NET / c#
MIT License
38 stars 31 forks source link

after ChoNACHAReader, I generate the a new achfile, the 6,8 and 9 records disappeared. #36

Closed xiaohui-hiwintech closed 4 years ago

xiaohui-hiwintech commented 4 years ago

I have two background jobs, one job is read the return file from Chase, another job is generated the ach file. I found a very stranger case, after reading the ach return file using the ChoNACHAReader, then another job generated the ach file will lose the 6, 8 and 9 records, please see bellow: image

if the reading ach file job didn't execute, the generated ach file job will work as expected. once the reading ach file job executed, all the rest of generated ach file jobs will lose the 6, 8 and 9 records. Can someone help me?

update: after many tests, i found that after foreach the ChoNACHAReader, the generated ach file job will lose the 6, 8 and 9 records image

xiaohui-hiwintech commented 4 years ago

@Cinchoo any suggestions will be helpful.

Cinchoo commented 4 years ago

I'm not clear about the issue, can you please brief me more in details?

  1. Are the reading fails to read 6,8,9 records?
  2. Or Writing fails to write 6,8,9 records?
  3. Is there log reported with error messages?

If you want to turn on the detailed error reporting of ChoETL.NACHA library, add this line at the Main() method

ChoETLFrxBootstrap.TraceLevel = System.Diagnostics.TraceLevel.Verbose;

xiaohui-hiwintech commented 4 years ago

Thanks, i will take a try.

Andrew-Elwood commented 4 years ago

I have the same issue. Here is more detail and how you can reproduce it.

ChoETL for .NET 4.x version 1.2.1.0 ChoETL.NACHA for .NET 4.x version 1.0.1.9

First, the issue only happens when you try to read in an existing NACHA file, then Write a NACHA file all in the same instance of the application. If I don't read in the NACHA file, but do the write operation it works great.

To Reproduce using your sample code on your GitHub page...

private void test() { foreach (var r in new ChoNACHAReader(@"C:\Temp\NACHA TEST DirDepTrans2132681.dat")) Console.WriteLine(r.ToStringEx());

        ChoNACHAConfiguration config = new ChoNACHAConfiguration();
        config.DestinationBankRoutingNumber = "123456789";
        config.OriginatingCompanyId = "123456789";
        config.DestinationBankName = "PNC Bank";
        config.OriginatingCompanyName = "Microsoft Inc.";
        config.ReferenceCode = "Internal Use Only.";
        config.BlockingFactor = 10;
        using (var nachaWriter = new ChoNACHAWriter(@"C:\users\andrew.swihart.elwood\desktop\NACHA_TEST.txt", config))
        {
            nachaWriter.Configuration.ErrorMode = ChoETL.ChoErrorMode.IgnoreAndContinue;

            using (var bw1 = nachaWriter.CreateBatch(200))
            {
                using (var entry1 = bw1.CreateDebitEntryDetail(20, "123456789", "1313131313", 22.505M, "ID Number", "ID Name", "Desc Data"))
                {
                    entry1.CreateAddendaRecord("Monthly bill");
                }
                using (var entry2 = bw1.CreateCreditEntryDetail(20, "123456789", "1313131313", 22.505M, "ID Number", "ID Name", "Desc Data"))
                {

                }
            }
            using (var bw2 = nachaWriter.CreateBatch(200))
            {
            }
        }
    }

Once you run the above code you will get the output in the attached file. You will see it is missing the 6,8 and 9 sections. NACHA_TEST.txt

I am not getting any errors either.

Thank you,

Andrew

Cinchoo commented 4 years ago

Found the issue, applying fix on ChoETL library. Will be pushing new package shortly. Thanks very much for your help.

Cinchoo commented 4 years ago

Below packages pushed to Nuget. Take them and try it out. Thanks.

ChoETL for .NET 4.x version 1.2.1.1 ChoETL.NACHA for .NET 4.x version 1.0.2.0

Andrew-Elwood commented 4 years ago

That appears to have fixed the issue. Thank you for getting this fixed so quickly.

Regards,

Andrew