{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/BotBuilder/issues/4538","repository_url":"https://api.github.com/repos/Microsoft/BotBuilder","labels_url":"https://api.github.com/repos/Microsoft/BotBuilder/issues/4538/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/BotBuilder/issues/4538/comments","events_url":"https://api.github.com/repos/Microsoft/BotBuilder/issues/4538/events","html_url":"https://github.com/Microsoft/BotBuilder/issues/4538","id":318048068,"number":4538,"title":"MissingMethodException thrown when accessing Microsoft.Bot.Builder.Dialogs.Conversation.Container","user":{"login":"tsahi","id":2961084,"avatar_url":"https://avatars1.githubusercontent.com/u/2961084?v=4","gravatar_id":"","url":"https://api.github.com/users/tsahi","html_url":"https://github.com/tsahi","followers_url":"https://api.github.com/users/tsahi/followers","following_url":"https://api.github.com/users/tsahi/following{/other_user}","gists_url":"https://api.github.com/users/tsahi/gists{/gist_id}","starred_url":"https://api.github.com/users/tsahi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsahi/subscriptions","organizations_url":"https://api.github.com/users/tsahi/orgs","repos_url":"https://api.github.com/users/tsahi/repos","events_url":"https://api.github.com/users/tsahi/events{/privacy}","received_events_url":"https://api.github.com/users/tsahi/received_events","type":"User","site_admin":false},"labels":[{"id":429202671,"url":"https://api.github.com/repos/Microsoft/BotBuilder/labels/.NET%20SDK","name":".NET SDK","color":"1d76db","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-04-26T14:12:07Z","updated_at":"2018-04-29T06:46:43Z","closed_at":null,"author_association":"NONE","body":"## Bot Info\r\n* SDK Platform: .NET\r\n* SDK Version: 3.15 (happens on 3.12.2.4 too)\r\n* Active Channels: bot emulator, WebChat, Direct Line\r\n* Deployment Environment: local development with Emulator\r\n\r\n## Issue Description\r\nMy bot is based on Azure Functions. I need to access state data from a Function which is triggered by a queue, in order to push a pro-active message to the user. So I implemented code from https://stackoverflow.com/questions/46085614/, but when I tried to access the implementing method, I received a `System.MissingMethodException: Method not found: 'Autofac.IContainer Microsoft.Bot.Builder.Dialogs.Conversation.get_Container()'.` exception.\r\n\r\n\r\n## Code Example\r\n(again, this is an Azure Function)\r\n\r\n```csharp\r\n        [FunctionName(\"PasswordResponseFunction\")]\r\n        public static async Task Run([ServiceBusTrigger(\"password-response\", AccessRights.Listen, Connection = \"ServiceBusReceivePasswordResponseConnection\")]BrokeredMessage message, TraceWriter log)\r\n        {\r\n            try\r\n            {\r\n                Stream body = message.GetBody<Stream>();\r\n                BinaryFormatter formatter = new BinaryFormatter();\r\n                String password = formatter.Deserialize(body) as String;\r\n                log.Info($\"C# ServiceBus queue trigger function processed message: { password }\");\r\n                IMessageActivity messageActivity = Activity.CreateMessageActivity();\r\n               // Set some messageActivity properties here\r\n                await SetPrivateConversationDataAsync(messageActivity, \"password\", password); // <-Exception thrown at this point\r\n\r\n                ConnectorClient client = new ConnectorClient(new Uri(ActivityDataEntity.ServiceUrl));\r\n                Activity activity = (Activity)messageActivity;\r\n                await client.Conversations.SendToConversationAsync(activity);\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                log.Error(ex.Message, ex);\r\n            }\r\n        }\r\n\r\n        private static async Task SetPrivateConversationDataAsync<T>(IMessageActivity messageActivity, String key, T value)\r\n        {\r\n            using (ILifetimeScope scope = DialogModule.BeginLifetimeScope(Conversation.Container, messageActivity)) //System.MissingMethodException\r\n            {\r\n                IBotDataStore<BotData> botDataStore = scope.Resolve<IBotDataStore<BotData>>();\r\n                Address address = Address.FromActivity(messageActivity);\r\n                BotData privateConversationData = await botDataStore.LoadAsync(address, BotStoreType.BotPrivateConversationData, CancellationToken.None);\r\n\r\n                privateConversationData.SetProperty(key, value);\r\n                await botDataStore.SaveAsync(address, BotStoreType.BotPrivateConversationData, privateConversationData,\r\n                    CancellationToken.None);\r\n\r\n                await botDataStore.FlushAsync(address, CancellationToken.None);\r\n            }\r\n        }\r\n```\r\n\r\n## Reproduction Steps\r\n1. Create a Class Library C# Function Bot\r\n    1. Create a C# Function Bot\r\n    2. Create an Azure Function with HTTP Trigger project in Visual Studio 2017\r\n    3. Copy the code from the generated Function Bot to your Function\r\n    4. Delete the C# Script bot from the Azure Portal\r\n    5. Deploy the function you created\r\n2. Add a call to `Conversation.Container`, such as `IContainer c = Conversation.Container;` to the function\r\n3. make a call to the bot from Bot Emulator\r\n\r\n## Expected Behavior\r\nGet an `IContainer`\r\n\r\n## Actual Results\r\nException as described.\r\n### Stack Trace:\r\nVaronis.Bot.Application.PasswordResponseFunction.<SetPrivateConversationDataAsync>d__1`1.MoveNext()\r\nSystem.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start(TStateMachine& stateMachine)\r\nVaronis.Bot.Application.PasswordResponseFunction.SetPrivateConversationDataAsync(IMessageActivity messageActivity, String key, T value)\r\nVaronis.Bot.Application.PasswordResponseFunction.<Run>d__0.MoveNext() in PasswordResponseFunction.cs: line: 48\r\n\r\n### Additional Info\r\nI Actually opened the Microsoft.Bot.Builder.dll with a decompiler (JetBrains dotPeek), and couldn't find the Conversation class there. But when I pressed F12 on the property in the code, the VS decompiler did take me to the property."},"comment":{"url":"https://api.github.com/repos/Microsoft/BotBuilder/issues/comments/385229974","html_url":"https://github.com/Microsoft/BotBuilder/issues/4538#issuecomment-385229974","issue_url":"https://api.github.com/repos/Microsoft/BotBuilder/issues/4538","id":385229974,"user":{"login":"tsahi","id":2961084,"avatar_url":"https://avatars1.githubusercontent.com/u/2961084?v=4","gravatar_id":"","url":"https://api.github.com/users/tsahi","html_url":"https://github.com/tsahi","followers_url":"https://api.github.com/users/tsahi/followers","following_url":"https://api.github.com/users/tsahi/following{/other_user}","gists_url":"https://api.github.com/users/tsahi/gists{/gist_id}","starred_url":"https://api.github.com/users/tsahi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsahi/subscriptions","organizations_url":"https://api.github.com/users/tsahi/orgs","repos_url":"https://api.github.com/users/tsahi/repos","events_url":"https://api.github.com/users/tsahi/events{/privacy}","received_events_url":"https://api.github.com/users/tsahi/received_events","type":"User","site_admin":false},"created_at":"2018-04-29T06:46:42Z","updated_at":"2018-04-29T06:46:42Z","author_association":"NONE","body":"That didn't help, @EricDahlvang . Still getting the same exception."}}
{"actor":{"display_login":"tsahi"}}