Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Adding placeholder Span debugger proxy #14749

Merged
merged 2 commits into from
Nov 8, 2017
Merged

Conversation

ahsonkhan
Copy link
Member

@ahsonkhan ahsonkhan commented Oct 30, 2017

@ahsonkhan ahsonkhan added the * NO MERGE * The PR is not ready for merge yet (see discussion for detailed reasons) label Oct 30, 2017
}

[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public unsafe T[] Items => _array;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why unsafe?

Copy link
Member Author

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.

@stephentoub
Copy link
Member

What does "placeholder" mean?

@ahsonkhan
Copy link
Member Author

ahsonkhan commented Oct 30, 2017

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.

@ahsonkhan
Copy link
Member Author

@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();
Copy link
Member

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

Copy link
Member Author

@ahsonkhan ahsonkhan Nov 8, 2017

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

image

image

@KrzysztofCwalina
Copy link
Member

@KrzysztofCwalina, do you think we should merge this even though it doesn't work atm? If not, shall I close the PR?

If @plnelson thinks it's useful to his investigations and could at some point work after fixing the debugger, then I would merge it.

@ahsonkhan ahsonkhan removed the * NO MERGE * The PR is not ready for merge yet (see discussion for detailed reasons) label Nov 8, 2017
@ahsonkhan ahsonkhan merged commit 512339d into dotnet:master Nov 8, 2017
@ahsonkhan ahsonkhan deleted the SpanProxy branch November 8, 2017 22:30
dotnet-bot pushed a commit to dotnet/corert that referenced this pull request Nov 9, 2017
* Adding placeholder Span debugger proxy.

* Remove unnecessary unsafe keyword.

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
stephentoub pushed a commit to dotnet/corert that referenced this pull request Nov 10, 2017
* Adding placeholder Span debugger proxy.

* Remove unnecessary unsafe keyword.

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
dotnet-bot pushed a commit to dotnet/corefx that referenced this pull request Jan 13, 2018
* Adding placeholder Span debugger proxy.

* Remove unnecessary unsafe keyword.

Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
dotnet-bot pushed a commit to dotnet/corefx that referenced this pull request Jan 13, 2018
* Adding placeholder Span debugger proxy.

* Remove unnecessary unsafe keyword.

Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
safern pushed a commit to dotnet/corefx that referenced this pull request Jan 16, 2018
* Adding placeholder Span debugger proxy.

* Remove unnecessary unsafe keyword.

Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
safern pushed a commit to dotnet/corefx that referenced this pull request Jan 16, 2018
* Adding placeholder Span debugger proxy.

* Remove unnecessary unsafe keyword.

Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants