botframework-sdk: Multiple custom attributes of the same type found. c# exception

Hi, My bot works in an instance in Azure, but when i tried to upload it to another instance, it stopped responding. Am getting the following exception.

Because of this we got rejected from Bot framework. @willportnoy Please help.

InternalServerError
{
  "message": "An error has occurred.",
  "exceptionMessage": "Multiple custom attributes of the same type found.",
  "exceptionType": "System.Reflection.AmbiguousMatchException",
  "stackTrace": "   at System.Attribute.GetCustomAttribute(Assembly element, Type attributeType, Boolean inherit)\r\n   at Microsoft.Rest.ServiceClient`1.get_FrameworkVersion()\r\n   at Microsoft.Rest.ServiceClient`1.SetDefaultUserAgentInfo()\r\n   at Microsoft.Rest.ServiceClient`1.SetUserAgent(String productName, String version)\r\n   at Microsoft.Rest.ServiceClient`1.InitializeHttpClient(HttpClientHandler httpClientHandler, DelegatingHandler[] handlers)\r\n   at Microsoft.Bot.Connector.ConnectorClient..ctor(Uri baseUri, DelegatingHandler[] handlers)\r\n   at Microsoft.Bot.Connector.ConnectorClient..ctor(Uri baseUri, String microsoftAppId, String microsoftAppPassword, DelegatingHandler[] handlers)\r\n   at HoroscopeBot.MessagesController.<Post>d__1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Threading.Tasks.TaskHelpersExtensions.<CastToObject>d__3`1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"
}

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 29 (4 by maintainers)

Most upvoted comments

The code and method names from the original call stack doesn’t match the version of Microsoft.Rest.ClientRuntime I have in my enlistment (2.3.2).

But it looks like this is the issue, though: https://github.com/Azure/autorest/issues/1542

Can you check your version of the Microsoft.Rest.ClientRuntime?

I’m going this issue for now (due to age, and we have a possible explanation above), but feel free to open a new issue for further discussion.

That might be the case, @alokraj68. I will run some tests and clear out all files via FTP before deploying the project. I will post any new insights here. Would be great to exactly know what this is caused by. I don’t want to work around the problem by deploying it to a new instance all the time.

@willportnoy, this was indeed the case. Thank you! I think adding Application Insights to my project upgraded my Microsoft.Rest.ClientRuntime to 2.3.4 which broke the bot. To fix it, I stripped every AI reference and downgraded to the ClientRuntime to 2.3.2.

It looks like the AI installation caused my problems. To avoid this in the future, is there any dependency lists that people can look up before upgrading at this point?

However, I deployed the same project to a new instance as suggested by @alokraj68 above, and it worked as well. So it is very ambiguous to me what exactly caused the issue. One the one hand the same project runs on one but not the other Azure instance. On the other hand, I downgraded the ClientRuntime and it worked again as well.

The issue is not resolved as no one could figure out what went wrong. seems like an issue with azure. please check it.

Sounds like the issue was resolved. If not, please let us know.

@alokraj68 Ok your fix worked. I had other problems due to my config files, but that’s alright now. Thanks !

ahah it begins with same letter sorry @alokraj68 😃