c# - FileHelpers Library - AfterReadRecord exceptions not being caught -


I am using version 2.9.9 from FileHelpers library, NuGet. When I try to use the AfterReadRecord event I'm running into a problem

When I remove an exception from this event, the exception is not taken by the library. It is my understanding that the Library will catch exceptions from the AfterReadRecord event and they will be creating ErrorInfo collections. Instead, in the VS 2013, a

"exception was rejected by the user code" Warning "An exception to the 'System.Exception' type was in FileHelpersTest.exe but in the user code" " No additional information: field 1 is invalid ".

What am I doing wrong? Thanks in advance!

The code looks like this:

  [DelimitedRecord ("," ) Public class MyClass {public string field 1; public string field 2; public string field 3;} class program {static zero main (string [] arg) {FileHelperEngine  engine = new FileHelper engine & lt; MyClass & gt; (); Engine.AfterReadRecord + = New FileHellds.Events.printHurdler  (Engine_EffitterRead Record); En Gine.ErrorMode = ErrorMode.SaveAndContinue; MyClass [] record = engine.Redstring (", 2,3"); ErrorInfo [] Errors = Engine.Error Manager.Ether; Console.WriteLine (. Errors.Count () ToString () ); Console.Read ();} Fixed zero engine_preferred record (enginebase engine, filehairs.events.fterRadAventAggs  E) {if (string. "Field 1 is invalid");} // I get an exception unchanged warning.}  

Your program works well for me.

Are you sure that this only the Visual Studio does not inform you that an exception was thrown. If you run an application outside of Visual Studio, does it work as expected?

You can change the behavior of exception handling of Visual Studio from the debug / exception ... menu. / P>


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -