Skip to content

Stack Overflow with new cloning changes #1212

@baywet

Description

@baywet

1.6.4-preview2 (just released earlier) produces stack overflows. Running dotnet test in this PR triggers the behavior. The DictionaryCloneHelper is probably missing some exist conditions.

at Microsoft.OpenApi.Models.OpenApiSchema..ctor(Microsoft.OpenApi.Models.OpenApiSchema)
   at Microsoft.OpenApi.Models.OpenApiMediaType..ctor(Microsoft.OpenApi.Models.OpenApiMediaType)
   at DynamicClass.InvokeStub_OpenApiMediaType..ctor(System.Object, System.Object, IntPtr*)
   at System.Reflection.ConstructorInvoker.Invoke(System.Object, IntPtr*, System.Reflection.BindingFlags)
   at System.Reflection.RuntimeConstructorInfo.Invoke(System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
   at System.RuntimeType.CreateInstanceImpl(System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
   at System.Activator.CreateInstance(System.Type, System.Object[])
   at Microsoft.OpenApi.Helpers.DictionaryCloneHelper.Clone[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IDictionary`2<System.__Canon,System.__Canon>)
   at Microsoft.OpenApi.Models.OpenApiResponse..ctor(Microsoft.OpenApi.Models.OpenApiResponse)
   at DynamicClass.InvokeStub_OpenApiResponse..ctor(System.Object, System.Object, IntPtr*)
   at System.Reflection.ConstructorInvoker.Invoke(System.Object, IntPtr*, System.Reflection.BindingFlags)
   at System.Reflection.RuntimeConstructorInfo.Invoke(System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
   at System.RuntimeType.CreateInstanceImpl(System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
   at System.Activator.CreateInstance(System.Type, System.Object[])
   at Microsoft.OpenApi.Helpers.DictionaryCloneHelper.Clone[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IDictionary`2<System.__Canon,System.__Canon>)
   at Microsoft.OpenApi.Models.OpenApiResponses..ctor(Microsoft.OpenApi.Models.OpenApiResponses)
   at Microsoft.OpenApi.Models.OpenApiOperation..ctor(Microsoft.OpenApi.Models.OpenApiOperation)
   at DynamicClass.InvokeStub_OpenApiOperation..ctor(System.Object, System.Object, IntPtr*)
   at System.Reflection.ConstructorInvoker.Invoke(System.Object, IntPtr*, System.Reflection.BindingFlags)
   at System.Reflection.RuntimeConstructorInfo.Invoke(System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
   at System.RuntimeType.CreateInstanceImpl(System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
   at System.Activator.CreateInstance(System.Type, System.Object[])
   at Microsoft.OpenApi.Helpers.DictionaryCloneHelper.Clone[[Microsoft.OpenApi.Models.OperationType, Microsoft.OpenApi, Version=1.6.4.0, Culture=neutral, PublicKeyToken=3f5743946376f042],[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IDictionary`2<Microsoft.OpenApi.Models.OperationType,System.__Canon>)
   at Microsoft.OpenApi.Models.OpenApiPathItem..ctor(Microsoft.OpenApi.Models.OpenApiPathItem)
   at DynamicClass.InvokeStub_OpenApiPathItem..ctor(System.Object, System.Object, IntPtr*)
   at System.Reflection.ConstructorInvoker.Invoke(System.Object, IntPtr*, System.Reflection.BindingFlags)
   at System.Reflection.RuntimeConstructorInfo.Invoke(System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
   at System.RuntimeType.CreateInstanceImpl(System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
   at System.Activator.CreateInstance(System.Type, System.Object[])
   at Microsoft.OpenApi.Helpers.DictionaryCloneHelper.Clone[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IDictionary`2<System.__Canon,System.__Canon>)
   at Microsoft.OpenApi.Models.OpenApiPaths..ctor(Microsoft.OpenApi.Models.OpenApiPaths)
   at Microsoft.OpenApi.Models.OpenApiDocument..ctor(Microsoft.OpenApi.Models.OpenApiDocument)
   at Microsoft.OpenApi.Models.OpenApiReference..ctor(Microsoft.OpenApi.Models.OpenApiReference)
--------------------------------
   at Microsoft.OpenApi.Models.OpenApiSchema..ctor(Microsoft.OpenApi.Models.OpenApiSchema)
   at Microsoft.OpenApi.Models.OpenApiMediaType..ctor(Microsoft.OpenApi.Models.OpenApiMediaType)
   at System.RuntimeMethodHandle.InvokeMethod(System.Object, Void**, System.Signature, Boolean)
   at System.Reflection.ConstructorInvoker.Invoke(System.Object, IntPtr*, System.Reflection.BindingFlags)
   at System.Reflection.RuntimeConstructorInfo.Invoke(System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
   at System.RuntimeType.CreateInstanceImpl(System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
   at System.Activator.CreateInstance(System.Type, System.Object[])
   at Microsoft.OpenApi.Helpers.DictionaryCloneHelper.Clone[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IDictionary`2<System.__Canon,System.__Canon>)
   at Microsoft.OpenApi.Models.OpenApiResponse..ctor(Microsoft.OpenApi.Models.OpenApiResponse)
   at System.RuntimeMethodHandle.InvokeMethod(System.Object, Void**, System.Signature, Boolean)
   at System.Reflection.ConstructorInvoker.Invoke(System.Object, IntPtr*, System.Reflection.BindingFlags)
   at System.Reflection.RuntimeConstructorInfo.Invoke(System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
   at System.RuntimeType.CreateInstanceImpl(System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
   at System.Activator.CreateInstance(System.Type, System.Object[])
   at Microsoft.OpenApi.Helpers.DictionaryCloneHelper.Clone[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IDictionary`2<System.__Canon,System.__Canon>)
   at Microsoft.OpenApi.Models.OpenApiResponses..ctor(Microsoft.OpenApi.Models.OpenApiResponses)
   at Microsoft.OpenApi.Models.OpenApiOperation..ctor(Microsoft.OpenApi.Models.OpenApiOperation)
   at System.RuntimeMethodHandle.InvokeMethod(System.Object, Void**, System.Signature, Boolean)
   at System.Reflection.ConstructorInvoker.Invoke(System.Object, IntPtr*, System.Reflection.BindingFlags)
   at System.Reflection.RuntimeConstructorInfo.Invoke(System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
   at System.RuntimeType.CreateInstanceImpl(System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
   at System.Activator.CreateInstance(System.Type, System.Object[])
   at Microsoft.OpenApi.Helpers.DictionaryCloneHelper.Clone[[Microsoft.OpenApi.Models.OperationType, Microsoft.OpenApi, Version=1.6.4.0, Culture=neutral, PublicKeyToken=3f5743946376f042],[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IDictionary`2<Microsoft.OpenApi.Models.OperationType,System.__Canon>)
   at Microsoft.OpenApi.Models.OpenApiPathItem..ctor(Microsoft.OpenApi.Models.Open

Test Run Aborted with error System.Exception: One or more errors occurred.
 ---> System.Exception: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host..
 ---> System.Exception: An existing connection was forcibly closed by the remote host.
   at System.Net.Sockets.NetworkStream.Read(Span`1 buffer)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.Read(Span`1 buffer)
   at System.Net.Sockets.NetworkStream.ReadByte()
   at System.IO.BinaryReader.Read7BitEncodedInt()
   at System.IO.BinaryReader.ReadString()
   at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.LengthPrefixCommunicationChannel.NotifyDataAvailable()
   at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.TcpClientExtensions.MessageLoopAsync(TcpClient client, ICommunicationChannel channel, Action`1 errorHandler, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---.

Metadata

Metadata

Assignees

Labels

bug-fix-vNextBug fixes need to be merged into both master and vNext. Use this tag for vNext bug fix PR.priority:p0Blocking issue/ loss of critical functions. An ICM may be filed to communicate urgency. SLA<=48hrstype:bugA broken experiencetype:regressionA bug from previous release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions