dotnet / interactive

.NET Interactive combines the power of .NET with many other languages to create notebooks, REPLs, and embedded coding experiences. Share code, explore data, write, and learn across your apps in ways you couldn't before.
MIT License
2.89k stars 385 forks source link

Very weird behaviour while using NetTopologySuite Nuget package #2042

Open PawelStadnicki opened 2 years ago

PawelStadnicki commented 2 years ago

Notebook with reproduction steps

This one is strange...

I went back to work on a feature that was fine ~2 months ago and noticed it is broken while using the latest .NET Interactive version

This part of the notebook works ok:

image

but the following cell does not on latest version (works ok with the older one)

image

When I run one more time the first cell that references the nuget I can continue process the data (until some random point in time when it breaks again)

image

PawelStadnicki commented 2 years ago

When I replaced the package with NetTopologySuite.IO.GeoJSON4STJ which is for System.Text.Json it works better, will confirm later today.

Update: nope, it still doesn't work. Can someone run the repro2.dib and check if you encounter the same issue?

colombod commented 2 years ago

Just running the first cell produces this stacktrace in the repro2.dib



kernel (83876) stderr:    at System.Collections.Generic.List`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].set_Capacity(Int32)
   at System.Collections.Generic.List`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Grow(Int32)

kernel (83876) stderr:    at System.Collections.Generic.List`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].AddWithResize(System.__Canon)
   at Microsoft.DotNet.Interactive.Formatting.EnumerableExtensions.TakeAndCountRemaining[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>, Int32, Boolean)
   at Microsoft.DotNet.Interactive.Formatting.Formatter.JoinGeneric[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>, System.IO.TextWriter, Microsoft.DotNet.Interactive.Formatting.FormatContext, System.Nullable`1<Int32>)

kernel (83876) stderr:    at System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Span`1<System.Object> ByRef, System.Signature, Boolean, Boolean)
   at System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)

kernel (83876) stderr:    at System.Delegate.DynamicInvokeImpl(System.Object[])

kernel (83876) stderr:    at System.Delegate.DynamicInvoke(System.Object[])

kernel (83876) stderr:    at Microsoft.DotNet.Interactive.Formatting.PlainTextFormatter`1+<>c__DisplayClass9_0[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].<CreateForAnyEnumerable>b__5(System.__Canon, Microsoft.DotNet.Interactive.Formatting.FormatContext)

kernel (83876) stderr:    at Microsoft.DotNet.Interactive.Formatting.PlainTextFormatter`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Format(System.__Canon, Microsoft.DotNet.Interactive.Formatting.FormatContext)

kernel (83876) stderr:    at Microsoft.DotNet.Interactive.Formatting.Formatter`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].FormatTo(System.__Canon, Microsoft.DotNet.Interactive.Formatting.FormatContext, System.String)

kernel (83876) stderr:    at Microsoft.DotNet.Interactive.Formatting.Formatter.FormatTo[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon, Microsoft.DotNet.Interactive.Formatting.FormatContext, System.String)

kernel (83876) stderr:    at Microsoft.DotNet.Interactive.Formatting.Formatter.JoinGeneric[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>, System.IO.TextWriter, Microsoft.DotNet.Interactive.Formatting.FormatContext, System.Nullable`1<Int32>)

kernel (83876) stderr:    at System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Span`1<System.Object> ByRef, System.Signature, Boolean, Boolean)
   at System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)

kernel (83876) stderr:    at System.Delegate.DynamicInvokeImpl(System.Object[])

kernel (83876) stderr:    at System.Delegate.DynamicInvoke(System.Object[])

kernel (83876) stderr:    at Microsoft.DotNet.Interactive.Formatting.PlainTextFormatter`1+<>c__DisplayClass9_0[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].<CreateForAnyEnumerable>b__5(System.__Canon, Microsoft.DotNet.Interactive.Formatting.FormatContext)

kernel (83876) stderr:    at Microsoft.DotNet.Interactive.Formatting.PlainTextFormatter`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Format(System.__Canon, Microsoft.DotNet.Interactive.Formatting.FormatContext)```
colombod commented 2 years ago

The PR #2061 has the is able to reproduce the issue. @PawelStadnicki @jonsequitur

One formatting the FeatrueCollection type it seems to go Stack overflow on the GeometryCollection