Cinchoo / ChoETL

ETL framework for .NET (Parser / Writer for CSV, Flat, Xml, JSON, Key-Value, Parquet, Yaml, Avro formatted files)
MIT License
746 stars 134 forks source link

[ChoXml] Creating a new XML reader seems to override debugger behavior #294

Closed KaceCottamLAI closed 9 months ago

KaceCottamLAI commented 9 months ago

It seems that after creating a new ChoXmlReader<>, I can no longer catch exceptions specifically with the debugger that would normally crash the program in main. This is interfering with debugging greatly. I can even wrap the function call below in a try-catch and it will catch the exception successfully, but will never pause the debugger with a breakpoint.

var configuration = new ChoXmlRecordConfiguration { ErrorMode = ChoErrorMode.ThrowAndStop };
throw new Exception("Debugger catches this");
var x = new ChoXmlReader<MyType>(path, configuration);
throw new Exception("Uncaught by debugger, shows \"An application error occurred\" in debugger console.");

Tested using Rider as well as Visual Studio 2022 on Windows 10. Full output:

An application error occurred. Please contact the administrator with the following information:

1) Exception Information
*********************************************
Exception Type: System.Exception
TargetSite: LanguageExt.Common.Result`1[InputReader.InputFile] Load(System.String)
Message: Uncaught by debugger, shows "An application error occurred" in debugger console.
Data: System.Collections.ListDictionaryInternal
HelpLink: NULL
Source: XmlSerializer
HResult: -2146233088

StackTrace Information
*********************************************
   at InputReader.InputFile.Load(String path) in C:\...\src\XmlSerializer\MxpoInputFile.cs:line 47
   at InputReader.InputConfiguration.Load(String path) in C:\...\src\XmlSerializer\InputConfiguration.cs:line 18
   at Program.<Main>$(String[] args) in C:\...\src\Runner\Program.cs:line 22
_______________________________________________

Other dependencies in the project:

Cinchoo commented 9 months ago

thanks for reporting, will be fixing it shortly.

Cinchoo commented 9 months ago

released v1.2.1.62 with the fix. try it.

KaceCottamLAI commented 9 months ago

Seems to have done the trick, thanks!