Dumping exceptions in LPRun8 is broken
I have a script that dumps an exception:
var e = new Exception("asdf"); e.Dump();
It runs fine in LINQPad and it used to run OK in LPRun as well but I've noticed that lately this errors. I'm using v8.8.9 (X64).
I think it used to work in earlier versions of LINQPad 8 but I can't confirm that. I can confirm that it works in LPRun7:
C:\>"C:\Program Files\LINQPad7\LPRun7.exe" asdf.linq { "TargetSite": null, "Message": "asdf", "Data": [], "InnerException": null, "HelpLink": null, "Source": null, "HResult": -2146233088, "StackTrace": null }
This is the error in LPRun8:
C:\>"C:\Program Files\LINQPad8\LPRun8.exe" asdf.linq JsonSerializationException: Self referencing loop detected for property 'Content' with type 'LINQPad.Hyperlinq'. Path 'TargetSite.Action.Target.dc'. at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CheckForCircularReference(JsonWriter writer, Object value, JsonProperty property, JsonContract contract, JsonContainerContract containerContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer, Object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, JsonContract& memberContract, Object& memberValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeISerializable(JsonWriter writer, ISerializable value, JsonISerializableContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType) at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType) at Newtonsoft.Json.JsonSerializer.Serialize(JsonWriter jsonWriter, Object value, Type objectType) at Newtonsoft.Json.JsonConvert.SerializeObjectInternal(Object value, Type type, JsonSerializer jsonSerializer) at Newtonsoft.Json.JsonConvert.SerializeObject(Object value, Type type, Formatting formatting, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.SerializeObject(Object value, Formatting formatting, JsonSerializerSettings settings) at LINQPad.ObjectGraph.Formatters.TextOutputWriter.NodeToText(ObjectNode node) at LINQPad.ObjectGraph.Formatters.TextOutputWriter.FormatObject(Object value, String heading, String lastHeading, GraphOptions options, Boolean& inline, TimeSpan& formattingTime) at LINQPad.ObjectGraph.Formatters.OutputWriter.WriteObject(Object value, String heading, GraphOptions options, Boolean noNewLine) at LINQPad.ObjectGraph.Formatters.OutputWriter.WriteLineObject(Object value, String heading, GraphOptions options, Boolean noNewLine) at LINQPad.Extensions.DumpCore[T](T o, String description, Nullable`1 depth, Nullable`1 collapseTo, Boolean toDataGrid, String exclude, String include, Nullable`1 alpha, Boolean noTotals, Nullable`1 repeatHeadersAt, Boolean includePrivate, Nullable`1 maxRows, Nullable`1 useInvariantCultureForNumbers, DumpFormatStrings formatStrings, Boolean forceObjectExpansion, Boolean descriptionWasAutoGenerated) at LINQPad.Extensions.Dump[T](T o, String description, Nullable`1 depth, Nullable`1 collapseTo, Boolean toDataGrid, String exclude, String include, Nullable`1 alpha, Boolean noTotals, Nullable`1 repeatHeadersAt, Boolean includePrivate) at LINQPad.Extensions.Dump[T](T o) at UserQuery.Main() in C:\Users\afrancis\AppData\Local\Temp\2\LINQPad8\__ravjmssn\ssjzny\LINQPadQuery:line 2 at LINQPad.ExecutionModel.ClrQueryRunner.Run() at LINQPad.ExecutionModel.Server.RunQuery(QueryRunner runner)
Comments
v8.9.2
LPRun fails with the error mentioned by OP. LPRun 5 (5.53) is OK.
LINQPad is OK.
Agreed, LINQPad is fine. LPRun is doing something different than it used to. If that's somehow intentional, then I'll have to change my code but it looks like an error. It's very convenient to be able to dump an exception and see some basic information about the error that caused the exception in the first place.
Might be regression introduced by these changes.
Thanks for the bug report. This should now be fixed in 8.9.3.
Thanks guys! We'll wait to see v8.9 get pushed out as the general release version before we test it out ourselves but I'm sure it's fine.
Great product, by the way, and thanks for the quick response!