ObjectDumper icon indicating copy to clipboard operation
ObjectDumper copied to clipboard

Option for swallowing exceptions

Open billrob opened this issue 4 years ago • 4 comments

I was using the nuget package currently out there and dumping some complex objects and where throwing an exception. I forked and coded out a SwallowException = true DumpOption, then noticed the default behavior has changed to swallowing and showing the exception message.

Could you get a new nuget package out? TIA

billrob avatar Sep 05 '20 05:09 billrob

@billrob can you try the latest 3.x nuget? https://www.nuget.org/packages/ObjectDumper.NET/3.0.20251.1

thomasgalliker avatar Sep 07 '20 19:09 thomasgalliker

@thomasgalliker It is working as expected. However, since I did all the work, I just reversed the SwallowException to ThrowException as I can picture a time where a dev would WANT the error to be thrown especially if they are using the CSharp emitter to do some dynamic appDomain to RPC calls.

https://github.com/thomasgalliker/ObjectDumper/pull/74

billrob avatar Sep 08 '20 04:09 billrob

Ah I just checked you change. Sure, we can „re-add“ such a configuration. Do you agree to keep it „safe“ by default (=catching the exception when GetValue() fails)?

I‘m busy this and next week, so it‘ll take some time to make its way into the next nuget :(

thomasgalliker avatar Sep 08 '20 04:09 thomasgalliker

Yes, that is the default behavior to swallow and not blow up. ThrowException defaults to false and I do mention that in the xml comment on the property.

There is no rush on it as it behaves now like I want it to. I was dumping out an AD record from an LDAP query and some property was throwing a COM exception that I didn't care about. I wanted to see what was in the object on a system I didn't have debugging rights to.

But since I did the work, I just inverted it incase someone WANTED the exception to be thrown.

billrob avatar Sep 08 '20 05:09 billrob