-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Adding placeholder Span debugger proxy #14749
Conversation
} | ||
|
||
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] | ||
public unsafe T[] Items => _array; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why unsafe
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oversight on my part. Will fix.
What does "placeholder" mean? |
This DebuggerTypeProxy, as it is written, will not let the user see the span elements in the debugger view. The implementation needs to be fixed based on feedback from the VS debugger team. I wanted to add a place holder to help them reproduce the issue specifically for "fast" span and wait for their feedback/workaround. |
@KrzysztofCwalina, do you think we should merge this even though it doesn't work atm? If not, shall I close the PR? |
|
||
public SpanDebugView(Span<T> span) | ||
{ | ||
_array = span.ToArray(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if making copy will work. You should talk to the debugger people or try on some other type wrapping an array. The reason is that I think the debugger instantiates just one proxy and then calls the properties on it multiple times (when it needs to refresh the view).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand. If the instantiation only happens once and only the items property gets called, then wouldn't this issue cause problems while debugging slow span too (see SpanDebugView)?
Can you provide a code sample that would cause issues?
byte[] array = new byte[5] { 1, 2, 3, 4, 5 };
string[] strArray = new string[6] { "12", "ab", "agfs", "AGadg", "ag", "" };
var span = new Span<byte>(array, 1, 3);
Console.WriteLine(span.Length);
span = span.Slice(2);
var rospan = new ReadOnlySpan<byte>(array, 1, 3);
Console.WriteLine(rospan.Length);
var span2 = new Span<string>(strArray, 1, 3);
Console.WriteLine(span2.Length);
}
If @plnelson thinks it's useful to his investigations and could at some point work after fixing the debugger, then I would merge it. |
* Adding placeholder Span debugger proxy. * Remove unnecessary unsafe keyword. Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
* Adding placeholder Span debugger proxy. * Remove unnecessary unsafe keyword. Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
* Adding placeholder Span debugger proxy. * Remove unnecessary unsafe keyword. Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
* Adding placeholder Span debugger proxy. * Remove unnecessary unsafe keyword. Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
* Adding placeholder Span debugger proxy. * Remove unnecessary unsafe keyword. Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
* Adding placeholder Span debugger proxy. * Remove unnecessary unsafe keyword. Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
cc @KrzysztofCwalina, @plnelson