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

Conversation

@benaadams
Copy link
Member

@benaadams benaadams force-pushed the TryGetOwnedMemory branch 3 times, most recently from faa6219 to c6f08e5 Compare February 20, 2018 20:52
}

ownedMemory = default;
return false;
Copy link
Member

Choose a reason for hiding this comment

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

How about:

TOwner owner = readOnlyMemory._object as TOwner;
ownedMemory = owner;
return owner != null;

?

}
namespace System.Runtime.InteropServices
{
using System.Buffers;
Copy link
Member

Choose a reason for hiding this comment

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

We don't do this in contracts. When this file is auto-generated by the tool at some point again, this will be removed and full names will be used everywhere. Might as well do so now.

Copy link
Member Author

Choose a reason for hiding this comment

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

Was having issues getting it compile; didn't know needed a change to coreclr also/first dotnet/coreclr#16455

return true;
}

ownedMemory = default;
Copy link
Member

Choose a reason for hiding this comment

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

default => null?

}
}

internal class OtherMemoryForTest<T> : OwnedMemory<T>
Copy link
Member

Choose a reason for hiding this comment

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

Why does the name start with "Other"?

Copy link
Member Author

Choose a reason for hiding this comment

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

There is a MemoryForTest this one is just for testing that it doesn't cast to it. Have a preferred name?

public static bool TryGetOwnedMemory<T, TOwner>(ReadOnlyMemory<T> readOnlyMemory, out TOwner ownedMemory)
where TOwner : OwnedMemory<T>
{
TOwner owner; // Use register for null comparision rahter than byref
Copy link
Member

Choose a reason for hiding this comment

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

Nit: rahter => rather

Copy link
Member

Choose a reason for hiding this comment

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

Nit: comparision => comparison

@benaadams
Copy link
Member Author

Squashed, as I assume it will have to go with a coreclr merge

@stephentoub
Copy link
Member

Squashed, as I assume it will have to go with a coreclr merge

It shouldn't. Nothing in the coreclr change introduced a break with corefx, did it? Assuming not, once that is consumed, this can just be re-run and then merged.

@benaadams
Copy link
Member Author

Doesn't it complain there is an implementation with no declaration? Or has that gone now?

@benaadams
Copy link
Member Author

Ah... Have to do something with this #27309 (comment)

@stephentoub
Copy link
Member

Doesn't it complain there is an implementation with no declaration? Or has that gone now?

I don't think it's ever complained about that. It definitely complains if there's something specified in the contract that doesn't exist in the implementation, but not the other way around.

@benaadams benaadams changed the title Add TryGetOwnedMemory Add TryGetOwnedMemory ref and tests Feb 21, 2018
@benaadams
Copy link
Member Author

K, think worked out how this mirroring works :)

@benaadams
Copy link
Member Author

Rebooting

@benaadams benaadams closed this Feb 21, 2018
@benaadams benaadams reopened this Feb 21, 2018
@benaadams
Copy link
Member Author

@dotnet-bot test OSX x64 Debug Build
@dotnet-bot test Windows x86 Release Build

@benaadams
Copy link
Member Author

OwnedMemoryBit needs to be removed from the index dotnet/coreclr#16479

@benaadams
Copy link
Member Author

NETFX unrelated

System.Net.Http.Functional.Tests.HttpCookieProtocolTests.GetAsyncWithRedirect_SetCookieContainer_CorrectCookiesSent [FAIL]
  System.Net.Http.HttpRequestException : An error occurred while sending the request.
  ---- System.Net.WebException : The request was aborted: The request was canceled.
  Stack Trace:
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Net.Http.HttpClient.<FinishSendAsyncBuffered>d__58.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Net.Http.Functional.Tests.HttpCookieProtocolTests.<<GetAsyncWithRedirect_SetCookieContainer_CorrectCookiesSent>b__15_0>d.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Net.Test.Common.LoopbackServer.<>c__DisplayClass11_0.<<CreateClientAndServerAsync>b__0>d.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Net.Test.Common.LoopbackServer.<CreateServerAsync>d__9.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Net.Http.Functional.Tests.HttpCookieProtocolTests.<GetAsyncWithRedirect_SetCookieContainer_CorrectCookiesSent>d__15.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    ----- Inner Stack Trace -----
       at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
       at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)

@benaadams
Copy link
Member Author

@dotnet-bot test NETFX x86 Release Build

@benaadams
Copy link
Member Author

@stephentoub should I raise an issue for the NETFX issue or is it just transient networking?

@stephentoub
Copy link
Member

should I raise an issue for the NETFX issue or is it just transient networking?

Please open an issue. I don't believe we've seen that one fail before, and it's using a loopback server, so really shouldn't have any significant transient networking issues. Thanks.

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