benaadams / Ben.Demystifier

High performance understanding for stack traces (Make error logs more productive)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

0.1.2 ToStringDemystified() misses exception detail

ig-sinicyn opened this issue · comments

			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);

Thank you for reporting!

Resolved by #79

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