benaadams / Ben.Demystifier

High performance understanding for stack traces (Make error logs more productive)
Apache License 2.0
2.76k stars 118 forks source link

0.1.2 ToStringDemystified() misses exception detail #78

Closed ig-sinicyn closed 5 years ago

ig-sinicyn commented 5 years ago
            Exception ex = null;
            try
            {
                throw new InvalidOperationException("aaa")
                {
                    Data =
                    {
                        ["bbb"] = "ccc",
                        ["ddd"] = "eee",
                    }
                };
            }
            catch (Exception e)
            {
                ex = e;
            }
            var str = ex.ToStringDemystified();

0.1.1 output

System.InvalidOperationException: aaa
   at void Tests.CommonTests.ExceptionDemistyfierTests.TestDemistifyWithData() in D:/.../Infrastructure.Tests/CommonTests/ExceptionDemistyfierTests.cs:line 47

0.1.2 output

   at void Tests.CommonTests.ExceptionDemistyfierTests.TestDemistifyWithData() in D:/.../Infrastructure.Tests/CommonTests/ExceptionDemistyfierTests.cs:line 47

BTW, the corresponding test is broken.

                var original = e.ToString();
                var stringDemystified = e.ToStringDemystified();

                _output.WriteLine("Demystified: ");
                _output.WriteLine(stringDemystified);

                _output.WriteLine("Original: ");
                var afterDemystified = e.ToString(); // <-- here
                _output.WriteLine(afterDemystified);

                Assert.Equal(original, afterDemystified);
benaadams commented 5 years ago

Thank you for reporting!

Resolved by https://github.com/benaadams/Ben.Demystifier/pull/79

New package https://www.nuget.org/packages/Ben.Demystifier/0.1.3