Elasticsearch NEST SDK throws System.OutOfMemoryException - elasticsearch

I am getting this exception from Elasticsearch .net client - NEST v7.10.0.
Exception of type 'System.OutOfMemoryException' was thrown. Elasticsearch.Net.UnexpectedElasticsearchClientException UnexpectedElasticsearchClientException Elasticsearch.Net.UnexpectedElasticsearchClientException: Exception of type 'System.OutOfMemoryException' was thrown.
---> System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.Text.UTF8Encoding.GetString(Byte[] bytes, Int32 index, Int32 count)
at Elasticsearch.Net.ResponseBuilder.SetSpecialTypes[TResponse](String mimeType, Byte[] bytes, IMemoryStreamFactory memoryStreamFactory, TResponse& cs)
at Elasticsearch.Net.ResponseBuilder.SetBodyAsync[TResponse](ApiCallDetails details, RequestData requestData, Stream responseStream, String mimeType, CancellationToken cancellationToken)
at Elasticsearch.Net.ResponseBuilder.ToResponseAsync[TResponse](RequestData requestData, Exception ex, Nullable`1 statusCode, IEnumerable`1 warnings, Stream responseStream, String mimeType, CancellationToken cancellationToken)
at Elasticsearch.Net.HttpConnection.RequestAsync[TResponse](RequestData requestData, CancellationToken cancellationToken)
at Elasticsearch.Net.RequestPipeline.CallElasticsearchAsync[TResponse](RequestData requestData, CancellationToken cancellationToken)
at Elasticsearch.Net.Transport`1.RequestAsync[TResponse](HttpMethod method, String path, CancellationToken cancellationToken, PostData data, IRequestParameters requestParameters)
What should be done to resolve this issue?
I am trying to query AWS elasticsearch cluster to get the results which seems to be very large in size.

Try to upgrade your client version to the latest version and also check Elasticsearch Nest official issue thread:
https://github.com/elastic/elasticsearch-net/issues/4697

Related

Ubantu Server with Elastic Search - Error Detail - Only one usage of each socket address (protocol/network address/port) is normally permitted Error

We have got below error in API which access data from Elastic Search. Error generated when web site traffic is high. We have configured Elastic Search on Single Node. We developed API(.NET core) by using NEST (7.15.1 library)
Please help us as its a production issue.
Our production serer configuration is:
Operating System-Ubuntu 18.04 LTS
Processor - Intel Xeon Gold 6140 – 12Core
RAM-128GB
HDD-500GB SSD
Error Detail:
FailureReason: FailedProductCheck while attempting POST on http://XX.XXX.XXX.XXX:XXXX/searchkeyword/_search?pretty=true&typed_keys=true
Audit trail of this API call:
OriginalException: System.Net.Http.HttpRequestException: Only one usage of each socket address (protocol/network address/port) is normally permitted.
---> System.Net.Sockets.SocketException (10048): Only one usage of each socket address (protocol/network address/port) is normally permitted.
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at Elasticsearch.Net.HttpConnection.Request[TResponse](RequestData requestData)
Request:
<Request stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>
Response:
Inner Exception: The client is unable to verify that the server is Elasticsearch due to an unsuccessful product check call. Some functionality may not be compatible if the server is running an unsupported product.
Elasticsearch.Net.PipelineException: The client is unable to verify that the server is Elasticsearch due to an unsuccessful product check call. Some functionality may not be compatible if the server is running an unsupported product.
---> System.Net.Http.HttpRequestException: Only one usage of each socket address (protocol/network address/port) is normally permitted.
---> System.Net.Sockets.SocketException (10048): Only one usage of each socket address (protocol/network address/port) is normally permitted.
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts) at Elasticsearch.Net.HttpConnection.Request[TResponse](RequestData requestData) --- End of inner exception stack trace --- at Elasticsearch.Net.RequestPipeline.ThrowIfTransientProductCheckFailure() at Elasticsearch.Net.RequestPipeline.Ping(Node node) at Elasticsearch.Net.Transport1.Ping(IRequestPipeline pipeline, Node node)
at Elasticsearch.Net.Transport`1.Request[TResponse](HttpMethod method, String path, PostData data, IRequestParameters requestParameters)
Exception:
Elasticsearch.Net.ElasticsearchClientException: The client is unable to verify that the server is Elasticsearch due to an unsuccessful product check call. Some functionality may not be compatible if the server is running an unsupported product. Call: Status code unknown from: GET /?pretty=true
---> Elasticsearch.Net.PipelineException: The client is unable to verify that the server is Elasticsearch due to an unsuccessful product check call. Some functionality may not be compatible if the server is running an unsupported product.
---> System.Net.Http.HttpRequestException: Only one usage of each socket address (protocol/network address/port) is normally permitted.
---> System.Net.Sockets.SocketException (10048): Only one usage of each socket address (protocol/network address/port) is normally permitted.
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at Elasticsearch.Net.HttpConnection.Request[TResponse](RequestData requestData)
We tried following thing to fix this issue but not succeed.
We have reset connection time out - 30 second and connection limit to 500.
Changed elastic search api port no 9800 to 9801.
We haver changed public IP address to private IP address.

Unauthorized error in User authentication in Bot in Government Cloud(GCC High)

I am getting Unauthorized error, bot setup details are given below. I have tried the same setup in commercial azure and it's working. Issue is only in GCC High Azure.
bot Setup in Azure portal (portal.azure.us)
Created Azure Bot in Azure portal.
Add new client secret in Bot Azure App.
Added redirect URI in authentication settings "https://tokengcch.botframework.azure.us/.auth/web/redirect"
In Bot configuration in Azure portal
Configured Messaging endpoint
Created oAuth connection setting - Test Connection is working.
Used TeamsAuth Sample code.
Updated AppSettings.json file.
MicrosoftAppId
MicrosoftAppPassword
ConnectionName
Added this code in startup.cs file as per this Article. (tried this and without this code also)
string uri = "https://apiGCCH.botframework.azure.us"; MicrosoftAppCredentials.TrustServiceUrl(uri); AuthClientConfig.OAuthEndpoint = uri;
I have made changes as per the document and still getting error.
Microsoft.Bot.Schema.ErrorResponseException: Operation returned an invalid status code 'BadGateway' at Microsoft.Bot.Connector.Conversations.ReplyToActivityWithHttpMessagesAsync
Using Bot Framework SDK version 4.16
Startup.cs file has this line: services.AddSingleton<BotFrameworkAuthentication, ConfigurationBotFrameworkAuthentication>();
Added configuration setting as per article as given below
{ "MicrosoftAppId": "db9c0376-41c2-4abc-bee6-a1c2f64b4f61", "MicrosoftAppPassword": "ad8...", "ConnectionName": "ccsGraphAuth", "ChannelService": "https://botframework.azure.us", "OAuthUrl": "https://tokengcch.botframework.azure.us/", "ToChannelFromBotLoginUrl": "https://login.microsoftonline.us/MicrosoftServices.onmicrosoft.us", "ToChannelFromBotOAuthScope": "https://api.botframework.us", "ToBotFromChannelTokenIssuer": "https://api.botframework.us", "ToBotFromChannelOpenIdMetadataUrl": "https://login.botframework.azure.us/v1/.well-known/openidconfiguration", "ToBotFromEmulatorOpenIdMetadataUrl": "https://login.microsoftonline.us/cab8a31a-1906-4287-a0d8-4eef66b95f6e/v2.0/.well-known/openid-configuration", "ValidateAuthority": true }
I have tried the bot in Teams and Web chat Channels. getting below excetion in both
Exception Message: Microsoft.Rest.HttpOperationException: Operation returned an invalid status code 'Unauthorized' at Microsoft.Bot.Connector.OAuthClient.GetSignInResourceWithHttpMessagesAsync(String state, String codeChallenge, String emulatorUrl, String finalRedirect, Dictionary2 customHeaders, CancellationToken cancellationToken) at Microsoft.Bot.Connector.BotSignInExtensions.GetSignInResourceAsync(OAuthClient operations, String state, String codeChallenge, String emulatorUrl, String finalRedirect, CancellationToken cancellationToken) at Microsoft.Bot.Connector.Authentication.UserTokenClientImpl.GetSignInResourceAsync(String connectionName, Activity activity, String finalRedirect, CancellationToken cancellationToken) at Microsoft.Bot.Builder.Dialogs.UserTokenAccess.GetSignInResourceAsync(ITurnContext turnContext, OAuthPromptSettings settings, CancellationToken cancellationToken) at Microsoft.Bot.Builder.Dialogs.OAuthPrompt.SendOAuthCardAsync(OAuthPromptSettings settings, ITurnContext turnContext, IMessageActivity prompt, CancellationToken cancellationToken) at Microsoft.Bot.Builder.Dialogs.OAuthPrompt.BeginDialogAsync(DialogContext dc, Object options, CancellationToken cancellationToken) at Microsoft.Bot.Builder.Dialogs.DialogContext.BeginDialogAsync(String dialogId, Object options, CancellationToken cancellationToken) at Microsoft.BotBuilderSamples.MainDialog.PromptStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) in D:\Bot\46.teams-auth\Dialogs\MainDialog.cs:line 51 at Microsoft.Bot.Builder.Dialogs.WaterfallDialog.OnStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) at Microsoft.Bot.Builder.Dialogs.WaterfallDialog.RunStepAsync(DialogContext dc, Int32 index, DialogReason reason, Object result, CancellationToken cancellationToken) at Microsoft.Bot.Builder.Dialogs.WaterfallDialog.BeginDialogAsync(DialogContext dc, Object options, CancellationToken cancellationToken) at Microsoft.Bot.Builder.Dialogs.DialogContext.BeginDialogAsync(String dialogId, Object options, CancellationToken cancellationToken)

System.NotImplementedException: byref delegate when using MessagePacks with xamarin.forms on iOS

I'm trying to implement deserialisation for MessagePacks.
I currently have a working implementation when I run my app on android. However, when I run the app on iOS, I get the following exception on runtime when hitting the deserialisation method.
System.NotImplementedException: byref delegate
System.Linq.Expressions.Interpreter
LightLambda.CreateCustomDelegate (System.Type delegateType)
System.Linq.Expressions.Interpreter
LightLambda.MakeDelegate (System.Type delegateType)
System.Linq.Expressions.Interpreter
LightDelegateCreator.CreateDelegate (System.Runtime.CompilerServices.IStrongBox[] closure)
System.Linq.Expressions.Interpreter
LightDelegateCreator.CreateDelegate ()
System.Linq.Expressions
Expression`1[TDelegate].Compile (System.Boolean preferInterpretation)
MessagePack.MessagePackSerializer+CompiledMethods
MessagePack.MessagePackSerializer+CompiledMethods..ctor (System.Type type) <0x1082e5c10 + 0x00e7b> in <7f586603e57b4990882764e9179b9d4b#7d9490cdb343bf249163494f476b29fc>:0
MessagePack.MessagePackSerializer+<>c
<.cctor>b__45_0 (System.Type t)
MessagePack.Internal
ThreadsafeTypeKeyHashTable`1[TValue].AddToBuckets (MessagePack.Internal.ThreadsafeTypeKeyHashTable`1+Entry[TValue][] buckets, System.Type newKey, MessagePack.Internal.ThreadsafeTypeKeyHashTable`1+Entry[TValue] newEntryOrNull, System.Func`2[T,TResult] valueFactory, TValue& resultingValue)
MessagePack.Internal
ThreadsafeTypeKeyHashTable`1[TValue].TryAddInternal (System.Type key, System.Func`2[T,TResult] valueFactory, TValue& resultingValue)
MessagePack.Internal
ThreadsafeTypeKeyHashTable`1[TValue].GetOrAdd (System.Type key, System.Func`2[T,TResult] valueFactory)
MessagePack
MessagePackSerializer.GetOrAdd (System.Type type)
MessagePack
MessagePackSerializer.Deserialize (System.Type type, System.IO.Stream stream, MessagePack.MessagePackSerializerOptions options, System.Threading.CancellationToken cancellationToken)
RailCube.Mobile.Http.Formatters
MessagePackInputFormatter.ReadFromStreamAsync (System.Type type, System.IO.Stream readStream, System.Net.Http.HttpContent content, System.Net.Http.Formatting.IFormatterLogger formatterLogger)
System.Net.Http.Formatting
MediaTypeFormatter.ReadFromStreamAsync (System.Type type, System.IO.Stream readStream, System.Net.Http.HttpContent content, System.Net.Http.Formatting.IFormatterLogger formatterLogger, System.Threading.CancellationToken cancellationToken)
System.Net.Http
HttpContentExtensions.ReadAsAsyncCore[T] (System.Net.Http.HttpContent content, System.Type type, System.Net.Http.Formatting.IFormatterLogger formatterLogger, System.Net.Http.Formatting.MediaTypeFormatter formatter, System.Threading.CancellationToken cancellationToken)
...
This is the method
public override Task<object> ReadFromStreamAsync(Type type, Stream readStream, HttpContent content, IFormatterLogger formatterLogger)
{
var options =
MessagePackSerializerOptions.Standard.WithResolver(
CompositeResolver.Create(
GeneratedResolver.Instance,
StandardResolver.Instance
));
// Exception thrown here.
var obj = MessagePackSerializer.Deserialize(type, readStream, options);
return Task.FromResult(obj);
}
I'm precompiling my custom types as recommended MessagePack Compiler via MSBuild Task which is working like a charm for android.
Has anybody got a clue why this exception is being thrown or what it even means? I really appreciate any help you can provide.

Bot not responding to messages in Bot Framework Emulator due to QnAMaker connection issue

My chatbot uses QnAMaker to respond to questions from the user. Recently this has stopped working when I'm testing in the Bot Framework Emulator. The bot is functioning perfectly in Web Chat however. I believe the issue occurs when I try to generate an answer from my QnAMaker Knowledge Base:
var response = await botServices.QnAServices[QnAMakerName].GetAnswersAsync(stepContext.Context, qnaMakerOptions);
This is the output I am getting in the console:
fail: Microsoft.BotBuilderSamples.QnABot[0]
Exception caught : System.Threading.Tasks.TaskCanceledException: The operation was canceled. ---> System.IO.IOException: Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request. ---> System.Net.Sockets.SocketException: The I/O operation has been aborted because of either a thread exit or an application request
--- End of inner exception stack trace ---
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.GetResult(Int16 token)
at System.Net.FixedSizeReader.ReadPacketAsync(Stream transport, AsyncProtocolRequest request)
at System.Net.Security.SslState.ThrowIfExceptional()
at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result)
at System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult asyncResult)
at System.Net.Security.SslStream.<>c.<AuthenticateAsClientAsync>b__47_1(IAsyncResult iar)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask`1 creationTask)
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at Microsoft.Bot.Builder.AI.QnA.HttpRequestUtils.ExecuteHttpRequestAsync(String requestUrl, String payloadBody, QnAMakerEndpoint endpoint) in d:\a\1\s\libraries\Microsoft.Bot.Builder.AI.QnA\Utils\HttpRequestUtils.cs:line 64
at Microsoft.Bot.Builder.AI.QnA.GenerateAnswerUtils.QueryQnaServiceAsync(Activity messageActivity, QnAMakerOptions options) in d:\a\1\s\libraries\Microsoft.Bot.Builder.AI.QnA\Utils\GenerateAnswerUtils.cs:line 212
at Microsoft.Bot.Builder.AI.QnA.GenerateAnswerUtils.GetAnswersRawAsync(ITurnContext turnContext, IMessageActivity messageActivity, QnAMakerOptions options) in d:\a\1\s\libraries\Microsoft.Bot.Builder.AI.QnA\Utils\GenerateAnswerUtils.cs:line 87
at Microsoft.Bot.Builder.AI.QnA.QnAMaker.GetAnswersRawAsync(ITurnContext turnContext, QnAMakerOptions options, Dictionary`2 telemetryProperties, Dictionary`2 telemetryMetrics) in d:\a\1\s\libraries\Microsoft.Bot.Builder.AI.QnA\QnAMaker.cs:line 198
at Microsoft.Bot.Builder.AI.QnA.QnAMaker.GetAnswersAsync(ITurnContext turnContext, QnAMakerOptions options, Dictionary`2 telemetryProperties, Dictionary`2 telemetryMetrics) in d:\a\1\s\libraries\Microsoft.Bot.Builder.AI.QnA\QnAMaker.cs:line 158
at X.Dialogs.QnAMakerDialog.CallGenerateAnswer(WaterfallStepContext stepContext, CancellationToken cancellationToken) in C:\Users\X\Desktop\X\Dialogs\QnAMakerDialog.cs:line 239
at Microsoft.Bot.Builder.Dialogs.WaterfallDialog.OnStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) in d:\a\1\s\libraries\Microsoft.Bot.Builder.Dialogs\WaterfallDialog.cs:line 175
at Microsoft.Bot.Builder.Dialogs.WaterfallDialog.RunStepAsync(DialogContext dc, Int32 index, DialogReason reason, Object result, CancellationToken cancellationToken) in d:\a\1\s\libraries\Microsoft.Bot.Builder.Dialogs\WaterfallDialog.cs:line 197
at Microsoft.Bot.Builder.Dialogs.WaterfallDialog.BeginDialogAsync(DialogContext dc, Object options, CancellationToken cancellationToken) in d:\a\1\s\libraries\Microsoft.Bot.Builder.Dialogs\WaterfallDialog.cs:line 82
at Microsoft.Bot.Builder.Dialogs.DialogContext.BeginDialogAsync(String dialogId, Object options, CancellationToken cancellationToken) in d:\a\1\s\libraries\Microsoft.Bot.Builder.Dialogs\DialogContext.cs:line 170
at Microsoft.BotBuilderSamples.QnABot.DispatchToTopIntentAsync(ITurnContext turnContext, IList`1 intent, RecognizerResult recognizerResult, CancellationToken cancellationToken) in C:\Users\X\Desktop\X\QnAMaker\QnABot.cs:line 171
at Microsoft.BotBuilderSamples.QnABot.OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken) in C:\Users\X\Desktop\X\QnAMaker\QnABot.cs:line 136
at Microsoft.Bot.Builder.BotFrameworkAdapter.TenantIdWorkaroundForTeamsMiddleware.OnTurnAsync(ITurnContext turnContext, NextDelegate next, CancellationToken cancellationToken) in d:\a\1\s\libraries\Microsoft.Bot.Builder\BotFrameworkAdapter.cs:line 1252
at Microsoft.Bot.Builder.MiddlewareSet.ReceiveActivityWithStatusAsync(ITurnContext turnContext, BotCallbackHandler callback, CancellationToken cancellationToken) in d:\a\1\s\libraries\Microsoft.Bot.Builder\MiddlewareSet.cs:line 55
at Microsoft.Bot.Builder.BotAdapter.RunPipelineAsync(ITurnContext turnContext, BotCallbackHandler callback, CancellationToken cancellationToken) in d:\a\1\s\libraries\Microsoft.Bot.Builder\BotAdapter.cs:line 200
Testing in the emulator always worked fine up until now. Anyone know how to solve?
One item that can cause this is if your development configuration is different from your Azure configuration. Please compare your QnAEndpointHostName, QnAEndpointKey, and QnAKnowledgebaseId to see if they differ between local and Azure.
If you've done anything different with local config lately, verify where those credentials are coming from. e.g. ASP.NET appSettings, secrets manager, or environment.
Also, since some of the stack trace is working with SSL types, you might want to double check that you're QnAEndpointHostName has an https protocol prefix.

NullReferenceException occurs when to use the XAML designer

After updating to the latest version of visual studio 2015, I am unable to use the XAML designer due to the fact that each time I attempt to open it a screen appears to inform me that a NullReferenceException has occurred.
I have tried the solution detailed in the post below, However, as I am not a HP user this solution didn't work for me.
Visual Studio 2015 (Community) designer shows NullReferenceException for blank Universal App
Please see the attached screenshot and error message below. Any help would be greatly appreciated
System.NullReferenceException
Object reference not set to an instance of an object.
Server stack trace:
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.IsolationBoundary.RemoteIsolationContext.<>c__DisplayClass14_0.<Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.IsolationBoundary.IRemoteContext.CreateInstance>b__0()
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.<>c__DisplayClass47_0`1.<MarshalIn>b__0()
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.Call.InvokeWorker()
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.Call.Invoke(Boolean waitingInExternalCall)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.InvokeCall(Call call)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.DirectInvoke(Boolean inbound, Action action, Int32 sourceApartmentId, Int32 targetApartmentId, Int32 originId, WaitHandle aborted)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.DirectInvokeInbound(Action action, Int32 targetApartmentId)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.MarshalIn(Action action, Int32 targetApartmentId, CancellationToken cancelToken, CallSynchronizationMode syncMode, CallModality callModality, String methodName, String filePath, Int32 lineNumber)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.MarshalIn(IRemoteObject targetObject, Action action, CallSynchronizationMode syncMode, CallModality callModality, ApartmentState apartmentState, String memberName, String filePath, Int32 lineNumber)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.MarshalIn[TResult](IRemoteObject targetObject, Func`1 func, CallModality callModality, ApartmentState apartmentState, String memberName, String filePath, Int32 lineNumber)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.IsolationBoundary.RemoteIsolationContext.Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.IsolationBoundary.IRemoteContext.CreateInstance(String assemblyName, String assemblyCodeBase, String typeName)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.IsolationBoundary.IRemoteContext.CreateInstance(String assemblyName, String assemblyCodeBase, String typeName)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.IsolationBoundary.<>c__DisplayClass38_0`1.<CreateInstance>b__0(IRemoteContext c)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.<>c__DisplayClass31_0`2.<MarshalOut>b__0()
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.Call.InvokeWorker()
System.NullReferenceException
Object reference not set to an instance of an object.
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.WaitForCompletion(NestedCallContext nestedCallContext, BlockingCall call, WaitHandle timeoutSignal)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.MarshalOutSynchronous(Action action, Int32 targetApartmentId, WaitHandle aborted, WaitHandle timeoutSignal, CancellationToken cancelToken, String methodName, String filePath, Int32 lineNumber)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.MarshalOut(Action action, Int32 targetApartmentId, WaitHandle aborted, CancellationToken cancelToken, CallSynchronizationMode syncMode, WaitHandle timeoutSignal, String methodName, String filePath, Int32 lineNumber)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.MarshalOut[TValue](RemoteHandle`1 targetObject, Action action, CallSynchronizationMode syncMode, ApartmentState apartmentState, String methodName, String filePath, Int32 lineNumber)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.MarshalOut[TResult,TValue](RemoteHandle`1 targetObject, Func`2 func, CallSynchronizationMode syncMode, ApartmentState apartmentState, String methodName, String filePath, Int32 lineNumber)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.IsolationBoundary.CreateInstance[T](Type type)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolatedObjectFactory.Initialize()
at Microsoft.VisualStudio.DesignTools.DesignerHost.Services.VSIsolationService.CreateObjectFactory(IIsolationTarget isolationTarget, IObjectCatalog catalog)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolationService.CreateLease(IIsolationTarget isolationTarget)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolationService.CreateLease(IIsolationTarget isolationTarget)
at Microsoft.VisualStudio.DesignTools.DesignerContract.IsolatedDesignerService.CreateLease(IIsolationTarget isolationTarget, CancellationToken cancelToken, DesignerServiceEntry& entry, IServiceProvider serviceOverrides)
at Microsoft.VisualStudio.DesignTools.DesignerContract.IsolatedDesignerService.IsolatedDesignerView.CreateDesignerViewInfo(CancellationToken cancelToken)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolatedTaskScheduler.InvokeWithCulture[T](CultureInfo culture, Func`2 func, CancellationToken cancelToken)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolatedTaskScheduler.<>c__DisplayClass10_0`1.<StartTask>b__0()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
You will have some code in a constructor that relies on something that would normally be set only at runtime (a database connection for example).
You will need to wrap the code in a test like this:
if (!Windows.ApplicationModel.DesignMode.DesignModeEnabled)
{
// Runtime mode specific functionality
}
Note The DesignModeEnabled property is available only in the presence of a developer certificate.
Source
You can either do this for all the code in the constructor or try to narrow it down so you only have the test round the minimum possible code. Alternatively you should look at moving that code out of the constructor into an OnLoaded event handler.
The same thing happened to me. I deleted the .vs, bin, obj directories in the project and it worked.

Resources