You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is exception when displaying ArraySegment with null value. The other enumerable values are just fine with null - like List, byte[] and etc.
This is one code example to repro the issue:
ArraySegment<byte> arraySeg = null;
arraySeg
Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.InvalidOperationException: The underlying array is null.
at Microsoft.DotNet.Interactive.Formatting.EnumerableExtensions.TakeAndCountRemaining[T](IEnumerable1 source, Int32 count, Boolean forceCountRemainder) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\EnumerableExtensions.cs:line 17 at Microsoft.DotNet.Interactive.Formatting.PlainTextFormatter.JoinGeneric[T](IEnumerable1 seq, TextWriter writer, FormatContext context) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\PlainTextFormatter.cs:line 350
at InvokeStub_Action3.Invoke(Object, Span1)
at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
--- End of inner exception stack trace ---
at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at Microsoft.DotNet.Interactive.Formatting.PlainTextFormatter1.<>c__DisplayClass8_0.<CreateForAnyEnumerable>b__5(T value, FormatContext context) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\PlainTextFormatter{T}.cs:line 103 at Microsoft.DotNet.Interactive.Formatting.PlainTextSummaryFormatter.<>c.<.cctor>b__7_2(IEnumerable obj, FormatContext context) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\PlainTextSummaryFormatter.cs:line 42 at Microsoft.DotNet.Interactive.Formatting.Formatter1.FormatTo(T obj, FormatContext context, String mimeType) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\Formatter{T}.cs:line 68
at lambda_method530(Closure, FormatContext, Object, String)
at Microsoft.DotNet.Interactive.Formatting.Formatter.ToDisplayString(Object obj, String mimeType) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\Formatter.cs:line 277
at Microsoft.DotNet.Interactive.Formatting.HtmlFormatter1.<>c__DisplayClass8_5.<CreateTreeViewFormatterForAnyObject>b__8(FormatContext context) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\HtmlFormatter{T}.cs:line 280 at Microsoft.DotNet.Interactive.Formatting.HtmlTag.WriteTo(FormatContext context) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\HtmlTag.cs:line 103 at Microsoft.DotNet.Interactive.Formatting.PocketView.Write(IReadOnlyList1 args, FormatContext context) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\PocketView.cs:line 220
at Microsoft.DotNet.Interactive.Formatting.PocketView.Write(IReadOnlyList1 args, FormatContext context) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\PocketView.cs:line 216 at Microsoft.DotNet.Interactive.Formatting.PocketView.Write(IReadOnlyList1 args, FormatContext context) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\PocketView.cs:line 216
at Microsoft.DotNet.Interactive.Formatting.PocketView.WriteTo(FormatContext context) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\PocketView.cs:line 283
at Microsoft.DotNet.Interactive.Formatting.HtmlFormatter1.<CreateTreeViewFormatterForAnyObject>g__BuildTreeView|8_3(T source, FormatContext context, ValueTuple2[] rows) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\HtmlFormatter{T}.cs:line 294
at Microsoft.DotNet.Interactive.Formatting.HtmlFormatter1.<>c__DisplayClass8_0.<CreateTreeViewFormatterForAnyObject>b__2(T instance, FormatContext context) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\HtmlFormatter{T}.cs:line 266 at Microsoft.DotNet.Interactive.Formatting.HtmlFormatter1.Format(T value, FormatContext context) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\HtmlFormatter{T}.cs:line 54
at Microsoft.DotNet.Interactive.Formatting.TypeFormatter1.Microsoft.DotNet.Interactive.Formatting.ITypeFormatter.Format(Object instance, FormatContext context) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\TypeFormatter{T}.cs:line 23 at Microsoft.DotNet.Interactive.Formatting.HtmlFormatter1.Format(T value, FormatContext context) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\HtmlFormatter{T}.cs:line 54
at Microsoft.DotNet.Interactive.Formatting.Formatter1.FormatTo(T obj, FormatContext context, String mimeType) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\Formatter{T}.cs:line 68 at lambda_method530(Closure, FormatContext, Object, String) at Microsoft.DotNet.Interactive.Formatting.Formatter.ToDisplayString(Object obj, String mimeType) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\Formatter.cs:line 277 at Microsoft.DotNet.Interactive.FormattedValue.<>c__DisplayClass12_0.<CreateManyFromObject>b__0(String mimeType) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\FormattedValue.cs:line 49 at System.Linq.Enumerable.SelectArrayIterator2.Fill(ReadOnlySpan1 source, Span1 destination, Func2 func) at System.Linq.Enumerable.SelectArrayIterator2.ToArray()
at Microsoft.DotNet.Interactive.FormattedValue.CreateManyFromObject(Object value, String[] mimeTypes) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive\FormattedValue.cs:line 47
at Microsoft.DotNet.Interactive.CSharp.CSharpKernel.Microsoft.DotNet.Interactive.IKernelCommandHandler<Microsoft.DotNet.Interactive.Commands.SubmitCode>.HandleAsync(SubmitCode submitCode, KernelInvocationContext context) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive.CSharp\CSharpKernel.cs:line 339
at Microsoft.DotNet.Interactive.Kernel.HandleAsync(KernelCommand command, KernelInvocationContext context) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive\Kernel.cs:line 365
at Microsoft.DotNet.Interactive.KernelCommandPipeline.b__6_0(KernelCommand command, KernelInvocationContext context, KernelPipelineContinuation _) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 60
at Microsoft.DotNet.Interactive.KernelCommandPipeline.SendAsync(KernelCommand command, KernelInvocationContext context) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 41
Which version of .NET Interactive are you using? (In a notebook, run the #!about magic command. ):
OS
Windows 11
Windows 10
macOS
Linux (Please specify distro)
iOS
Android
Browser
Chrome
Edge
Firefox
Safari
Frontend
Jupyter Notebook
Jupyter Lab
nteract
Visual Studio Code
Visual Studio Code Insiders
Visual Studio
Other (please specify)
Screenshots
The text was updated successfully, but these errors were encountered:
Describe the bug
There is exception when displaying ArraySegment with null value. The other enumerable values are just fine with null - like List, byte[] and etc.
This is one code example to repro the issue:
Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.InvalidOperationException: The underlying array is null.
at Microsoft.DotNet.Interactive.Formatting.EnumerableExtensions.TakeAndCountRemaining[T](IEnumerable
1 source, Int32 count, Boolean forceCountRemainder) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\EnumerableExtensions.cs:line 17 at Microsoft.DotNet.Interactive.Formatting.PlainTextFormatter.JoinGeneric[T](IEnumerable
1 seq, TextWriter writer, FormatContext context) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\PlainTextFormatter.cs:line 350at InvokeStub_Action
3.Invoke(Object, Span
1)at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
--- End of inner exception stack trace ---
at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at Microsoft.DotNet.Interactive.Formatting.PlainTextFormatter
1.<>c__DisplayClass8_0.<CreateForAnyEnumerable>b__5(T value, FormatContext context) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\PlainTextFormatter{T}.cs:line 103 at Microsoft.DotNet.Interactive.Formatting.PlainTextSummaryFormatter.<>c.<.cctor>b__7_2(IEnumerable obj, FormatContext context) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\PlainTextSummaryFormatter.cs:line 42 at Microsoft.DotNet.Interactive.Formatting.Formatter
1.FormatTo(T obj, FormatContext context, String mimeType) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\Formatter{T}.cs:line 68at lambda_method530(Closure, FormatContext, Object, String)
at Microsoft.DotNet.Interactive.Formatting.Formatter.ToDisplayString(Object obj, String mimeType) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\Formatter.cs:line 277
at Microsoft.DotNet.Interactive.Formatting.HtmlFormatter
1.<>c__DisplayClass8_5.<CreateTreeViewFormatterForAnyObject>b__8(FormatContext context) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\HtmlFormatter{T}.cs:line 280 at Microsoft.DotNet.Interactive.Formatting.HtmlTag.WriteTo(FormatContext context) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\HtmlTag.cs:line 103 at Microsoft.DotNet.Interactive.Formatting.PocketView.Write(IReadOnlyList
1 args, FormatContext context) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\PocketView.cs:line 220at Microsoft.DotNet.Interactive.Formatting.PocketView.Write(IReadOnlyList
1 args, FormatContext context) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\PocketView.cs:line 216 at Microsoft.DotNet.Interactive.Formatting.PocketView.Write(IReadOnlyList
1 args, FormatContext context) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\PocketView.cs:line 216at Microsoft.DotNet.Interactive.Formatting.PocketView.WriteTo(FormatContext context) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\PocketView.cs:line 283
at Microsoft.DotNet.Interactive.Formatting.HtmlFormatter
1.<CreateTreeViewFormatterForAnyObject>g__BuildTreeView|8_3(T source, FormatContext context, ValueTuple
2[] rows) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\HtmlFormatter{T}.cs:line 294at Microsoft.DotNet.Interactive.Formatting.HtmlFormatter
1.<>c__DisplayClass8_0.<CreateTreeViewFormatterForAnyObject>b__2(T instance, FormatContext context) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\HtmlFormatter{T}.cs:line 266 at Microsoft.DotNet.Interactive.Formatting.HtmlFormatter
1.Format(T value, FormatContext context) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\HtmlFormatter{T}.cs:line 54at Microsoft.DotNet.Interactive.Formatting.TypeFormatter
1.Microsoft.DotNet.Interactive.Formatting.ITypeFormatter.Format(Object instance, FormatContext context) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\TypeFormatter{T}.cs:line 23 at Microsoft.DotNet.Interactive.Formatting.HtmlFormatter
1.Format(T value, FormatContext context) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\HtmlFormatter{T}.cs:line 54at Microsoft.DotNet.Interactive.Formatting.Formatter
1.FormatTo(T obj, FormatContext context, String mimeType) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\Formatter{T}.cs:line 68 at lambda_method530(Closure, FormatContext, Object, String) at Microsoft.DotNet.Interactive.Formatting.Formatter.ToDisplayString(Object obj, String mimeType) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive.Formatting\Formatter.cs:line 277 at Microsoft.DotNet.Interactive.FormattedValue.<>c__DisplayClass12_0.<CreateManyFromObject>b__0(String mimeType) in D:\a\_work\1\s\src\Microsoft.DotNet.Interactive\FormattedValue.cs:line 49 at System.Linq.Enumerable.SelectArrayIterator
2.Fill(ReadOnlySpan1 source, Span
1 destination, Func2 func) at System.Linq.Enumerable.SelectArrayIterator
2.ToArray()at Microsoft.DotNet.Interactive.FormattedValue.CreateManyFromObject(Object value, String[] mimeTypes) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive\FormattedValue.cs:line 47
at Microsoft.DotNet.Interactive.CSharp.CSharpKernel.Microsoft.DotNet.Interactive.IKernelCommandHandler<Microsoft.DotNet.Interactive.Commands.SubmitCode>.HandleAsync(SubmitCode submitCode, KernelInvocationContext context) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive.CSharp\CSharpKernel.cs:line 339
at Microsoft.DotNet.Interactive.Kernel.HandleAsync(KernelCommand command, KernelInvocationContext context) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive\Kernel.cs:line 365
at Microsoft.DotNet.Interactive.KernelCommandPipeline.b__6_0(KernelCommand command, KernelInvocationContext context, KernelPipelineContinuation _) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 60
at Microsoft.DotNet.Interactive.KernelCommandPipeline.SendAsync(KernelCommand command, KernelInvocationContext context) in D:\a_work\1\s\src\Microsoft.DotNet.Interactive\KernelCommandPipeline.cs:line 41
Which version of .NET Interactive are you using? (In a notebook, run the
#!about
magic command. ):Screenshots
The text was updated successfully, but these errors were encountered: