Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThays Grazia <thaystg@gmail.com>2019-10-10 21:55:26 +0300
committerJo Shields <joshield@microsoft.com>2019-10-10 21:55:26 +0300
commit0ddb4a5328c6de5b3761c0814117027c0f3a1f69 (patch)
tree97402b6552c6c9f8d68b2f6579cfa7482372ea90
parent3baa35f64016a2a1acb62dcfb5c29cca6461ae9c (diff)
Fix System.MissingMemberException (#359)
* Fixing unit test error of xamarin-macios during mono 2019-10 integration. Error: System.MissingMemberException : The lazily-initialized type does not have a public, parameterless constructor. Marek suggested to use a factory lambda when calling LazyInitializer.EnsureInitialized.
-rw-r--r--src/System.Net.Sockets/src/System/Net/Sockets/Socket.Tasks.cs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/System.Net.Sockets/src/System/Net/Sockets/Socket.Tasks.cs b/src/System.Net.Sockets/src/System/Net/Sockets/Socket.Tasks.cs
index 4e0b8cf521..f71148a8bf 100644
--- a/src/System.Net.Sockets/src/System/Net/Sockets/Socket.Tasks.cs
+++ b/src/System.Net.Sockets/src/System/Net/Sockets/Socket.Tasks.cs
@@ -52,7 +52,7 @@ namespace System.Net.Sockets
internal Task<Socket> AcceptAsync(Socket acceptSocket)
{
// Get any cached SocketAsyncEventArg we may have.
- TaskSocketAsyncEventArgs<Socket> saea = Interlocked.Exchange(ref LazyInitializer.EnsureInitialized(ref _cachedTaskEventArgs).TaskAccept, s_rentedSocketSentinel);
+ TaskSocketAsyncEventArgs<Socket> saea = Interlocked.Exchange(ref LazyInitializer.EnsureInitialized(ref _cachedTaskEventArgs, () => { return new CachedEventArgs(); }).TaskAccept, s_rentedSocketSentinel);
if (saea == s_rentedSocketSentinel)
{
// An instance was once created (or is currently being created elsewhere), but some other
@@ -194,7 +194,7 @@ namespace System.Net.Sockets
return new ValueTask<int>(Task.FromCanceled<int>(cancellationToken));
}
- AwaitableSocketAsyncEventArgs saea = LazyInitializer.EnsureInitialized(ref LazyInitializer.EnsureInitialized(ref _cachedTaskEventArgs).ValueTaskReceive);
+ AwaitableSocketAsyncEventArgs saea = LazyInitializer.EnsureInitialized(ref LazyInitializer.EnsureInitialized(ref _cachedTaskEventArgs, () => { return new CachedEventArgs(); } ).ValueTaskReceive, () => { return new AwaitableSocketAsyncEventArgs(); });
if (saea.Reserve())
{
Debug.Assert(saea.BufferList == null);
@@ -343,7 +343,7 @@ namespace System.Net.Sockets
return new ValueTask<int>(Task.FromCanceled<int>(cancellationToken));
}
- AwaitableSocketAsyncEventArgs saea = LazyInitializer.EnsureInitialized(ref LazyInitializer.EnsureInitialized(ref _cachedTaskEventArgs).ValueTaskSend);
+ AwaitableSocketAsyncEventArgs saea = LazyInitializer.EnsureInitialized(ref LazyInitializer.EnsureInitialized(ref _cachedTaskEventArgs, () => { return new CachedEventArgs(); } ).ValueTaskSend, () => { return new AwaitableSocketAsyncEventArgs(); });
if (saea.Reserve())
{
Debug.Assert(saea.BufferList == null);
@@ -367,7 +367,7 @@ namespace System.Net.Sockets
return new ValueTask(Task.FromCanceled(cancellationToken));
}
- AwaitableSocketAsyncEventArgs saea = LazyInitializer.EnsureInitialized(ref LazyInitializer.EnsureInitialized(ref _cachedTaskEventArgs).ValueTaskSend);
+ AwaitableSocketAsyncEventArgs saea = LazyInitializer.EnsureInitialized(ref LazyInitializer.EnsureInitialized(ref _cachedTaskEventArgs, () => { return new CachedEventArgs(); } ).ValueTaskSend, () => { return new AwaitableSocketAsyncEventArgs(); });
if (saea.Reserve())
{
Debug.Assert(saea.BufferList == null);
@@ -644,7 +644,7 @@ namespace System.Net.Sockets
private Int32TaskSocketAsyncEventArgs RentSocketAsyncEventArgs(bool isReceive)
{
// Get any cached SocketAsyncEventArg we may have.
- CachedEventArgs cea = LazyInitializer.EnsureInitialized(ref _cachedTaskEventArgs);
+ CachedEventArgs cea = LazyInitializer.EnsureInitialized(ref _cachedTaskEventArgs, () => { return new CachedEventArgs(); });
Int32TaskSocketAsyncEventArgs saea = isReceive ?
Interlocked.Exchange(ref cea.TaskReceive, s_rentedInt32Sentinel) :
Interlocked.Exchange(ref cea.TaskSend, s_rentedInt32Sentinel);